@designcombo/video 0.1.12 → 0.1.13

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.
@@ -0,0 +1,46 @@
1
+ import { Difference } from 'microdiff';
2
+ import { ClipJSON, ProjectJSON, StudioTrackJSON } from '../json-serialization';
3
+ export interface HistoryOptions {
4
+ maxSize?: number;
5
+ }
6
+ export interface HistoryState {
7
+ clips: Record<string, ClipJSON>;
8
+ tracks: StudioTrackJSON[];
9
+ settings: any;
10
+ }
11
+ export declare class HistoryManager {
12
+ private past;
13
+ private future;
14
+ private lastState;
15
+ private maxSize;
16
+ constructor(options?: HistoryOptions);
17
+ private projectToHistoryState;
18
+ /**
19
+ * Initialize history with the starting state
20
+ */
21
+ init(state: ProjectJSON): void;
22
+ /**
23
+ * Push a new state to history. Calculates the diff from the last state.
24
+ */
25
+ push(newState: ProjectJSON): void;
26
+ /**
27
+ * Undo the last action. Returns the patches and the new target state.
28
+ */
29
+ undo(currentState: ProjectJSON): {
30
+ patches: Difference[];
31
+ state: HistoryState;
32
+ } | null;
33
+ /**
34
+ * Redo the next action. Returns the patches and the new target state.
35
+ */
36
+ redo(currentState: ProjectJSON): {
37
+ patches: Difference[];
38
+ state: HistoryState;
39
+ } | null;
40
+ /**
41
+ * Apply patches to an object.
42
+ */
43
+ private applyPatches;
44
+ canUndo(): boolean;
45
+ canRedo(): boolean;
46
+ }
@@ -38,7 +38,15 @@ export declare class TimelineModel {
38
38
  private addClipToTrack;
39
39
  private setupClipVisuals;
40
40
  private emitAddClipEvents;
41
- removeClip(clip: IClip): Promise<void>;
41
+ removeClip(clip: IClip, options?: {
42
+ permanent: boolean;
43
+ }): Promise<void>;
44
+ /**
45
+ * Remove multiple clips in a batch
46
+ */
47
+ removeClips(clips: IClip[], options?: {
48
+ permanent: boolean;
49
+ }): Promise<void>;
42
50
  removeClipById(clipId: string): Promise<void>;
43
51
  updateClip(clipId: string, updates: Partial<IClip>): Promise<void>;
44
52
  updateClips(updates: {
package/dist/studio.d.ts CHANGED
@@ -8,6 +8,7 @@ import { default as EventEmitter } from './event-emitter';
8
8
  import { SelectionManager } from './studio/selection-manager';
9
9
  import { Transport } from './studio/transport';
10
10
  import { TimelineModel } from './studio/timeline-model';
11
+ import { HistoryManager } from './studio/history-manager';
11
12
  export interface IStudioOpts {
12
13
  width: number;
13
14
  height: number;
@@ -79,6 +80,10 @@ export interface StudioEvents {
79
80
  pause: {
80
81
  isPlaying: boolean;
81
82
  };
83
+ 'history:changed': {
84
+ canUndo: boolean;
85
+ canRedo: boolean;
86
+ };
82
87
  [key: string]: any;
83
88
  [key: symbol]: any;
84
89
  }
@@ -92,6 +97,7 @@ export declare class Studio extends EventEmitter<StudioEvents> {
92
97
  selection: SelectionManager;
93
98
  transport: Transport;
94
99
  timeline: TimelineModel;
100
+ history: HistoryManager;
95
101
  pixiApp: Application | null;
96
102
  get tracks(): StudioTrack[];
97
103
  get clips(): IClip[];
@@ -120,6 +126,10 @@ export declare class Studio extends EventEmitter<StudioEvents> {
120
126
  };
121
127
  destroyed: boolean;
122
128
  private renderingSuspended;
129
+ private historyPaused;
130
+ private processingHistory;
131
+ private historyGroupDepth;
132
+ private clipCache;
123
133
  globalEffects: Map<string, GlobalEffectInfo>;
124
134
  activeGlobalEffect: ActiveGlobalEffect | null;
125
135
  currentGlobalEffectSprite: Sprite | null;
@@ -150,7 +160,16 @@ export declare class Studio extends EventEmitter<StudioEvents> {
150
160
  */
151
161
  constructor(opts: IStudioOpts);
152
162
  private handleTimelineChange;
163
+ private saveHistory;
164
+ beginHistoryGroup(): void;
165
+ endHistoryGroup(): void;
166
+ private setPath;
167
+ private applyHistoryPatches;
168
+ undo(): Promise<void>;
169
+ redo(): Promise<void>;
170
+ private cleanupClipVisuals;
153
171
  private handleClipRemoved;
172
+ private handleClipsRemoved;
154
173
  private initPixiApp;
155
174
  /**
156
175
  * Get studio options
@@ -212,11 +231,13 @@ export declare class Studio extends EventEmitter<StudioEvents> {
212
231
  * Remove a clip from the studio
213
232
  */
214
233
  removeClip(clip: IClip): Promise<void>;
234
+ removeClips(clips: IClip[]): Promise<void>;
215
235
  removeClipById(clipId: string): Promise<void>;
216
- deleteSelected(): Promise<void>;
236
+ removeClipsById(clipIds: string[]): Promise<void>;
217
237
  /**
218
- * Duplicate all currently selected clips
238
+ * Delete all currently selected clips
219
239
  */
240
+ deleteSelected(): Promise<void>;
220
241
  duplicateSelected(): Promise<void>;
221
242
  splitSelected(splitTime?: number): Promise<void>;
222
243
  trimSelected(trimFromSeconds: number): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { E as p, U as Ne, T as ee, F as je, G as he, v as fe, M as P, l as C, d as pe, I as v, t as w, a8 as $, R as N, w as L, H as me, a5 as G, a6 as ge, c as F, B as T, D as j, S as M, y as D, af as qe, ag as q, L as Y, ah as U, s as Q, a0 as Qe, $ as X, n as xe, q as _e, aa as be, ad as ye, o as Je, p as Ze, ab as et, ac as tt, ae as rt, ai as nt, aj as st, ak as it, al as H, am as at, an as ot, m as ve, ao as te, ap as k, e as b, aq as ut } from "./index-Bg9KGlQ_.js";
1
+ import { E as p, U as Ne, T as ee, F as je, G as he, v as fe, M as P, l as C, d as pe, I as v, t as w, a8 as $, R as N, w as L, H as me, a5 as G, a6 as ge, c as F, B as T, D as j, S as M, y as D, af as qe, ag as q, L as Y, ah as U, s as Q, a0 as Qe, $ as X, n as xe, q as _e, aa as be, ad as ye, o as Je, p as Ze, ab as et, ac as tt, ae as rt, ai as nt, aj as st, ak as it, al as H, am as at, an as ot, m as ve, ao as te, ap as k, e as b, aq as ut } from "./index-DSnnNrXJ.js";
2
2
  import { c as z, a as lt, b as ct, B as Te } from "./colorToUniform-C2jGzNe1.js";
3
3
  class Pe {
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcombo/video",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Video rendering and processing library",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -21,8 +21,7 @@
21
21
  "files": [
22
22
  "dist"
23
23
  ],
24
-
25
- "main": "dist/index.umd.js",
24
+ "main": "dist/index.umd.js",
26
25
  "module": "dist/index.es.js",
27
26
  "types": "dist/index.d.ts",
28
27
  "exports": {
@@ -47,6 +46,7 @@
47
46
  "dependencies": {
48
47
  "@pixi/layout": "^3.2.0",
49
48
  "gl-transitions": "^1.43.0",
49
+ "microdiff": "^1.4.0",
50
50
  "opfs-tools": "^0.7.2",
51
51
  "pixi.js": "^8.14.3",
52
52
  "wave-resampler": "^1.0.0",