@shotstack/shotstack-studio 1.2.2 → 1.4.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/dist/shotstack-studio.es.js +5110 -4533
- package/dist/shotstack-studio.umd.js +8 -6
- package/dist/src/components/canvas/index.d.ts +14 -0
- package/dist/{core/entities → src/components/canvas/players}/audio-player.d.ts +3 -3
- package/dist/{core/entities → src/components/canvas/players}/html-player.d.ts +3 -3
- package/dist/{core/entities → src/components/canvas/players}/image-player.d.ts +3 -3
- package/dist/{core/entities → src/components/canvas/players}/luma-player.d.ts +3 -3
- package/dist/{core/entities → src/components/canvas/players}/player.d.ts +5 -4
- package/dist/{core/entities → src/components/canvas/players}/shape-player.d.ts +3 -3
- package/dist/src/components/canvas/players/text-player.d.ts +19 -0
- package/dist/{core/entities → src/components/canvas/players}/video-player.d.ts +3 -3
- package/dist/{core → src/components/canvas}/shotstack-canvas.d.ts +2 -2
- package/dist/{core/entities → src/components/canvas/system}/inspector.d.ts +1 -1
- package/dist/src/components/canvas/text/text-cursor.d.ts +47 -0
- package/dist/src/components/canvas/text/text-editor.d.ts +43 -0
- package/dist/src/components/canvas/text/text-input-handler.d.ts +54 -0
- package/dist/src/core/commands/add-clip-command.d.ts +14 -0
- package/dist/src/core/commands/add-track-command.d.ts +8 -0
- package/dist/src/core/commands/delete-clip-command.d.ts +10 -0
- package/dist/src/core/commands/delete-track-command.d.ts +9 -0
- package/dist/src/core/commands/set-updated-clip-command.d.ts +17 -0
- package/dist/src/core/commands/types.d.ts +25 -0
- package/dist/src/core/commands/update-text-content-command.d.ts +16 -0
- package/dist/{core/entities → src/core}/edit.d.ts +13 -7
- package/dist/{core → src/core}/export/video-exporter.d.ts +2 -2
- package/dist/{core → src/core}/inputs/controls.d.ts +1 -1
- package/dist/{core → src/core}/schemas/clip.d.ts +78 -78
- package/dist/{core → src/core}/schemas/edit.d.ts +302 -302
- package/dist/{core → src/core}/schemas/track.d.ts +106 -106
- package/dist/src/index.d.ts +4 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +1 -1
- package/readme.md +17 -6
- package/dist/core/entities/text-player.d.ts +0 -18
- package/dist/index.d.ts +0 -4
- package/dist/{core → src/core}/animations/curve-interpolator.d.ts +0 -0
- package/dist/{core → src/core}/animations/effect-preset-builder.d.ts +0 -0
- package/dist/{core → src/core}/animations/keyframe-builder.d.ts +0 -0
- package/dist/{core → src/core}/animations/transition-preset-builder.d.ts +0 -0
- package/dist/{core → src/core}/events/asset-load-tracker.d.ts +0 -0
- package/dist/{core → src/core}/events/event-emitter.d.ts +0 -0
- package/dist/{core → src/core}/inputs/pointer.d.ts +0 -0
- package/dist/{core → src/core}/layouts/geometry.d.ts +0 -0
- package/dist/{core → src/core}/layouts/position-builder.d.ts +0 -0
- package/dist/{core → src/core}/loaders/asset-loader.d.ts +0 -0
- package/dist/{core → src/core}/loaders/audio-load-parser.d.ts +0 -0
- package/dist/{core → src/core}/loaders/font-load-parser.d.ts +0 -0
- package/dist/{core → src/core}/schemas/asset.d.ts +32 -32
- package/dist/{core → src/core}/schemas/audio-asset.d.ts +8 -8
- package/dist/{core → src/core}/schemas/html-asset.d.ts +2 -2
- package/dist/{core → src/core}/schemas/image-asset.d.ts +2 -2
- package/dist/{core → src/core}/schemas/keyframe.d.ts +2 -2
- package/dist/{core → src/core}/schemas/luma-asset.d.ts +2 -2
- package/dist/{core → src/core}/schemas/shape-asset.d.ts +0 -0
- package/dist/{core → src/core}/schemas/text-asset.d.ts +0 -0
- package/dist/{core → src/core}/schemas/video-asset.d.ts +8 -8
- /package/dist/{core/entities → src/core/shared}/entity.d.ts +0 -0
- /package/dist/{main.d.ts → src/main.d.ts} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import type
|
|
1
|
+
import type { Edit } from "@core/edit";
|
|
2
|
+
import { type Size } from "@layouts/geometry";
|
|
3
|
+
import { type Clip } from "@schemas/clip";
|
|
4
4
|
import { Player } from "./player";
|
|
5
5
|
export declare class AudioPlayer extends Player {
|
|
6
6
|
private audioResource;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Size } from "
|
|
2
|
-
import { type Clip } from "
|
|
3
|
-
import type { Edit } from "
|
|
1
|
+
import { type Size } from "@layouts/geometry";
|
|
2
|
+
import { type Clip } from "@schemas/clip";
|
|
3
|
+
import type { Edit } from "core/edit";
|
|
4
4
|
import { Player } from "./player";
|
|
5
5
|
export declare class HtmlPlayer extends Player {
|
|
6
6
|
private background;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import type
|
|
1
|
+
import type { Edit } from "@core/edit";
|
|
2
|
+
import { type Size } from "@layouts/geometry";
|
|
3
|
+
import { type Clip } from "@schemas/clip";
|
|
4
4
|
import { Player } from "./player";
|
|
5
5
|
export declare class ImagePlayer extends Player {
|
|
6
6
|
private texture;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Edit } from "@core/edit";
|
|
2
|
+
import { type Size } from "@layouts/geometry";
|
|
3
|
+
import { type Clip } from "@schemas/clip";
|
|
1
4
|
import * as pixi from "pixi.js";
|
|
2
|
-
import { type Size } from "../layouts/geometry";
|
|
3
|
-
import { type Clip } from "../schemas/clip";
|
|
4
|
-
import type { Edit } from "./edit";
|
|
5
5
|
import { Player } from "./player";
|
|
6
6
|
export declare class LumaPlayer extends Player {
|
|
7
7
|
private texture;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
4
|
-
import { Entity } from "
|
|
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
5
|
/**
|
|
6
6
|
* TODO: Move handles on UI level (screen space)
|
|
7
7
|
* TODO: Handle overlapping frames - ex: length of a clip is 1.5s but there's an in (1s) and out (1s) transition
|
|
@@ -46,6 +46,7 @@ export declare abstract class Player extends Entity {
|
|
|
46
46
|
private rotationOffset;
|
|
47
47
|
private initialClipConfiguration;
|
|
48
48
|
constructor(edit: Edit, clipConfiguration: Clip);
|
|
49
|
+
reconfigureAfterRestore(): void;
|
|
49
50
|
protected configureKeyframes(): void;
|
|
50
51
|
load(): Promise<void>;
|
|
51
52
|
update(_: number, __: number): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import type
|
|
1
|
+
import type { Edit } from "@core/edit";
|
|
2
|
+
import { type Size } from "@layouts/geometry";
|
|
3
|
+
import { type Clip } from "@schemas/clip";
|
|
4
4
|
import { Player } from "./player";
|
|
5
5
|
export declare class ShapePlayer extends Player {
|
|
6
6
|
private shape;
|
|
@@ -0,0 +1,19 @@
|
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import type
|
|
1
|
+
import type { Edit } from "@core/edit";
|
|
2
|
+
import { type Size } from "@layouts/geometry";
|
|
3
|
+
import { type Clip } from "@schemas/clip";
|
|
4
4
|
import { Player } from "./player";
|
|
5
5
|
export declare class VideoPlayer extends Player {
|
|
6
6
|
private texture;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Edit } from "
|
|
2
|
-
import { type Size } from "
|
|
1
|
+
import { Edit } from "@core/edit";
|
|
2
|
+
import { type Size } from "@layouts/geometry";
|
|
3
3
|
export declare class Canvas {
|
|
4
4
|
private static extensionsRegistered;
|
|
5
5
|
private readonly size;
|
|
@@ -0,0 +1,47 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClipSchema } from "@schemas/clip";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { EditCommand, CommandContext } from "./types";
|
|
4
|
+
type ClipType = z.infer<typeof ClipSchema>;
|
|
5
|
+
export declare class AddClipCommand implements EditCommand {
|
|
6
|
+
private trackIdx;
|
|
7
|
+
private clip;
|
|
8
|
+
name: string;
|
|
9
|
+
private addedPlayer?;
|
|
10
|
+
constructor(trackIdx: number, clip: ClipType);
|
|
11
|
+
execute(context?: CommandContext): Promise<void>;
|
|
12
|
+
undo(context?: CommandContext): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EditCommand, CommandContext } from "./types";
|
|
2
|
+
export declare class AddTrackCommand implements EditCommand {
|
|
3
|
+
private trackIdx;
|
|
4
|
+
name: string;
|
|
5
|
+
constructor(trackIdx: number);
|
|
6
|
+
execute(context?: CommandContext): void;
|
|
7
|
+
undo(context?: CommandContext): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EditCommand, CommandContext } from "./types";
|
|
2
|
+
export declare class DeleteClipCommand implements EditCommand {
|
|
3
|
+
private trackIdx;
|
|
4
|
+
private clipIdx;
|
|
5
|
+
name: string;
|
|
6
|
+
private deletedClip?;
|
|
7
|
+
constructor(trackIdx: number, clipIdx: number);
|
|
8
|
+
execute(context?: CommandContext): void;
|
|
9
|
+
undo(context?: CommandContext): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditCommand, CommandContext } from "./types";
|
|
2
|
+
export declare class DeleteTrackCommand implements EditCommand {
|
|
3
|
+
private trackIdx;
|
|
4
|
+
name: string;
|
|
5
|
+
private deletedClips;
|
|
6
|
+
constructor(trackIdx: number);
|
|
7
|
+
execute(context?: CommandContext): void;
|
|
8
|
+
undo(context?: CommandContext): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Player } from "@canvas/players/player";
|
|
2
|
+
import { ClipSchema } from "@schemas/clip";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { EditCommand, CommandContext } from "./types";
|
|
5
|
+
type ClipType = z.infer<typeof ClipSchema>;
|
|
6
|
+
export declare class SetUpdatedClipCommand implements EditCommand {
|
|
7
|
+
private clip;
|
|
8
|
+
private initialClipConfig;
|
|
9
|
+
private finalClipConfig;
|
|
10
|
+
name: string;
|
|
11
|
+
private storedInitialConfig;
|
|
12
|
+
private storedFinalConfig;
|
|
13
|
+
constructor(clip: Player, initialClipConfig: ClipType | null, finalClipConfig: ClipType | null);
|
|
14
|
+
execute(context?: CommandContext): void;
|
|
15
|
+
undo(context?: CommandContext): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Player } from "@canvas/players/player";
|
|
2
|
+
import type { ClipSchema } from "@schemas/clip";
|
|
3
|
+
import type { Container } from "pixi.js";
|
|
4
|
+
import type { z } from "zod";
|
|
5
|
+
type ClipType = z.infer<typeof ClipSchema>;
|
|
6
|
+
export type EditCommand = {
|
|
7
|
+
execute(context?: CommandContext): void | Promise<void>;
|
|
8
|
+
undo?(context?: CommandContext): void | Promise<void>;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
};
|
|
11
|
+
export type CommandContext = {
|
|
12
|
+
getClips(): Player[];
|
|
13
|
+
getTracks(): Player[][];
|
|
14
|
+
getContainer(): Container;
|
|
15
|
+
addPlayer(trackIdx: number, player: Player): Promise<void>;
|
|
16
|
+
createPlayerFromAssetType(clipConfiguration: ClipType): Player;
|
|
17
|
+
queueDisposeClip(player: Player): void;
|
|
18
|
+
disposeClips(): void;
|
|
19
|
+
undeleteClip(trackIdx: number, clip: Player): void;
|
|
20
|
+
setUpdatedClip(clip: Player): void;
|
|
21
|
+
restoreClipConfiguration(clip: Player, previousConfig: ClipType): void;
|
|
22
|
+
updateDuration(): void;
|
|
23
|
+
emitEvent(name: string, data: unknown): void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Player } from "@canvas/players/player";
|
|
2
|
+
import type { ClipSchema } from "@schemas/clip";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
import type { EditCommand, CommandContext } from "./types";
|
|
5
|
+
type ClipType = z.infer<typeof ClipSchema>;
|
|
6
|
+
export declare class UpdateTextContentCommand implements EditCommand {
|
|
7
|
+
private clip;
|
|
8
|
+
private newText;
|
|
9
|
+
private initialConfig;
|
|
10
|
+
name: string;
|
|
11
|
+
private previousText;
|
|
12
|
+
constructor(clip: Player, newText: string, initialConfig: ClipType);
|
|
13
|
+
execute(context?: CommandContext): void;
|
|
14
|
+
undo(context?: CommandContext): void;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { EventEmitter } from "@core/events/event-emitter";
|
|
2
|
+
import { Entity } from "@core/shared/entity";
|
|
3
|
+
import type { Size } from "@layouts/geometry";
|
|
4
|
+
import { AssetLoader } from "@loaders/asset-loader";
|
|
5
|
+
import { ClipSchema } from "@schemas/clip";
|
|
6
|
+
import { EditSchema } from "@schemas/edit";
|
|
7
|
+
import { TrackSchema } from "@schemas/track";
|
|
1
8
|
import { z } from "zod";
|
|
2
|
-
import { EventEmitter } from "../events/event-emitter";
|
|
3
|
-
import type { Size } from "../layouts/geometry";
|
|
4
|
-
import { AssetLoader } from "../loaders/asset-loader";
|
|
5
|
-
import { ClipSchema } from "../schemas/clip";
|
|
6
|
-
import { EditSchema } from "../schemas/edit";
|
|
7
|
-
import { TrackSchema } from "../schemas/track";
|
|
8
|
-
import { Entity } from "./entity";
|
|
9
9
|
type EditType = z.infer<typeof EditSchema>;
|
|
10
10
|
type ClipType = z.infer<typeof ClipSchema>;
|
|
11
11
|
type TrackType = z.infer<typeof TrackSchema>;
|
|
@@ -17,6 +17,8 @@ export declare class Edit extends Entity {
|
|
|
17
17
|
private tracks;
|
|
18
18
|
private clipsToDispose;
|
|
19
19
|
private clips;
|
|
20
|
+
private commandHistory;
|
|
21
|
+
private commandIndex;
|
|
20
22
|
playbackTime: number;
|
|
21
23
|
totalDuration: number;
|
|
22
24
|
constructor(size: Size, backgroundColor?: string);
|
|
@@ -34,6 +36,10 @@ export declare class Edit extends Entity {
|
|
|
34
36
|
getTrack(trackIdx: number): TrackType | null;
|
|
35
37
|
deleteTrack(trackIdx: number): void;
|
|
36
38
|
getTotalDuration(): number;
|
|
39
|
+
undo(): void;
|
|
40
|
+
redo(): void;
|
|
41
|
+
private executeCommand;
|
|
42
|
+
private createCommandContext;
|
|
37
43
|
private queueDisposeClip;
|
|
38
44
|
protected disposeClips(): void;
|
|
39
45
|
private disposeClip;
|