@shotstack/shotstack-studio 2.0.0-beta.13 → 2.0.0-beta.15

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/index.d.ts CHANGED
@@ -196,6 +196,8 @@ export declare class Canvas {
196
196
  private currentZoom;
197
197
  private onTickBound;
198
198
  private onBackgroundClickBound;
199
+ private onWheelBound;
200
+ private canvasRoot;
199
201
  constructor(edit: Edit);
200
202
  /**
201
203
  * Register a UIController to receive tick updates for canvas overlays.
@@ -204,6 +206,7 @@ export declare class Canvas {
204
206
  registerUIController(controller: UIController): void;
205
207
  load(): Promise<void>;
206
208
  private setupTouchHandling;
209
+ private onWheel;
207
210
  centerEdit(): void;
208
211
  zoomToFit(padding?: number): void;
209
212
  resize(): void;
@@ -278,9 +281,10 @@ export declare class CanvasToolbar {
278
281
  private backgroundChangeCallback;
279
282
  private clickOutsideHandler;
280
283
  private showMergeFields;
281
- constructor(edit?: Edit, options?: {
282
- mergeFields?: boolean;
283
- });
284
+ private maxPixels?;
285
+ constructor(edit?: Edit, options?: CanvasToolbarOptions);
286
+ /** Check if given dimensions exceed the configured pixel limit */
287
+ private isOverLimit;
284
288
  /** Get the edit as ShotstackEdit if it has merge field capabilities */
285
289
  private getShotstackEdit;
286
290
  setPosition(screenX: number, screenY: number): void;
@@ -299,6 +303,8 @@ export declare class CanvasToolbar {
299
303
  private renderVariablesList;
300
304
  private addVariable;
301
305
  setResolution(width: number, height: number): void;
306
+ /** Update warning state for inputs when loaded resolution exceeds configured limit */
307
+ private updateConstraintWarning;
302
308
  setFps(fps: number): void;
303
309
  setBackground(color: string): void;
304
310
  onResolutionChange(callback: ResolutionChangeCallback): void;
@@ -307,6 +313,12 @@ export declare class CanvasToolbar {
307
313
  dispose(): void;
308
314
  }
309
315
 
316
+ declare interface CanvasToolbarOptions {
317
+ mergeFields?: boolean;
318
+ /** Maximum total pixels allowed for custom resolution input. Omit for unlimited. */
319
+ maxPixels?: number;
320
+ }
321
+
310
322
  export declare type CaptionAsset = components["schemas"]["CaptionAsset"];
311
323
 
312
324
  export { CaptionAssetSchema }
@@ -403,6 +415,15 @@ declare type CommandContext = {
403
415
  untrackEndLengthClip(clip: Player): void;
404
416
  trackEndLengthClip(clip: Player): void;
405
417
  getMergeFields(): MergeFieldService;
418
+ getOutputSize(): {
419
+ width: number;
420
+ height: number;
421
+ };
422
+ setOutputSize(width: number, height: number): void;
423
+ getOutputFps(): number;
424
+ setOutputFps(fps: number): void;
425
+ getTimelineBackground(): string;
426
+ setTimelineBackground(color: string): void;
406
427
  };
407
428
 
408
429
  export declare class Controls {
@@ -514,6 +535,12 @@ export declare const DestinationSchema: z.ZodUnion<readonly [z.ZodIntersection<z
514
535
 
515
536
  export declare class Edit extends Entity {
516
537
  private static readonly ZIndexPadding;
538
+ /**
539
+ * Maximum number of commands to keep in undo history.
540
+ * Prevents unbounded memory growth in long editing sessions.
541
+ * Each command may hold Player references and deep-cloned configs.
542
+ */
543
+ private static readonly MAX_HISTORY_SIZE;
517
544
  assetLoader: AssetLoader;
518
545
  events: EventEmitter<EditEventMap & InternalEventMap>;
519
546
  private edit;
@@ -557,6 +584,8 @@ export declare class Edit extends Entity {
557
584
  */
558
585
  private initializeFromDocument;
559
586
  private updateViewportMask;
587
+ /** Update canvas visuals after size change (viewport mask, background, zoom) */
588
+ private updateCanvasForSize;
560
589
  play(): void;
561
590
  pause(): void;
562
591
  seek(target: number): void;
@@ -795,6 +824,10 @@ export declare class Edit extends Entity {
795
824
  getOutputFormat(): string;
796
825
  setOutputDestinations(destinations: Destination[]): void;
797
826
  getOutputDestinations(): Destination[];
827
+ setOutputResolution(resolution: string): void;
828
+ getOutputResolution(): string | undefined;
829
+ setOutputAspectRatio(aspectRatio: string): void;
830
+ getOutputAspectRatio(): string | undefined;
798
831
  getTimelineFonts(): Array<{
799
832
  src: string;
800
833
  }>;
@@ -815,6 +848,14 @@ export declare class Edit extends Entity {
815
848
  pruneUnusedFonts(): void;
816
849
  setTimelineBackground(color: string): void;
817
850
  getTimelineBackground(): string;
851
+ /**
852
+ * Resolve merge field placeholders in a string.
853
+ * Replaces {{ FIELD_NAME }} patterns with their current values.
854
+ *
855
+ * @param input - String potentially containing merge field placeholders
856
+ * @returns String with all merge fields resolved to their values
857
+ */
858
+ resolveMergeFields(input: string): string;
818
859
  /**
819
860
  * @deprecated Use `ui.registerButton()` instead.
820
861
  */
@@ -900,6 +941,11 @@ declare type Edit_2 = components["schemas"]["Edit"];
900
941
  declare type EditCommand = {
901
942
  execute(context?: CommandContext): void | Promise<void>;
902
943
  undo?(context?: CommandContext): void | Promise<void>;
944
+ /**
945
+ * Optional cleanup when command is pruned from history.
946
+ * Called when command is removed to free memory (e.g., Player references, deep-cloned configs).
947
+ */
948
+ dispose?(): void;
903
949
  readonly name: string;
904
950
  };
905
951
 
@@ -927,6 +973,8 @@ export declare const EditEvent: {
927
973
  readonly TrackRemoved: "track:removed";
928
974
  readonly DurationChanged: "duration:changed";
929
975
  readonly OutputResized: "output:resized";
976
+ readonly OutputResolutionChanged: "output:resolutionChanged";
977
+ readonly OutputAspectRatioChanged: "output:aspectRatioChanged";
930
978
  readonly OutputFpsChanged: "output:fpsChanged";
931
979
  readonly OutputFormatChanged: "output:formatChanged";
932
980
  readonly OutputDestinationsChanged: "output:destinationsChanged";
@@ -994,6 +1042,12 @@ export declare type EditEventMap = {
994
1042
  width: number;
995
1043
  height: number;
996
1044
  };
1045
+ [EditEvent.OutputResolutionChanged]: {
1046
+ resolution: string | undefined;
1047
+ };
1048
+ [EditEvent.OutputAspectRatioChanged]: {
1049
+ aspectRatio: string | undefined;
1050
+ };
997
1051
  [EditEvent.OutputFpsChanged]: {
998
1052
  fps: number;
999
1053
  };
@@ -1338,6 +1392,14 @@ export { OffsetSchema }
1338
1392
 
1339
1393
  export declare type Output = components["schemas"]["Output"];
1340
1394
 
1395
+ export declare const OutputAspectRatioSchema: z.ZodOptional<z.ZodEnum<{
1396
+ "16:9": "16:9";
1397
+ "9:16": "9:16";
1398
+ "1:1": "1:1";
1399
+ "4:3": "4:3";
1400
+ "4:5": "4:5";
1401
+ }>>;
1402
+
1341
1403
  export declare const OutputFormatSchema: z.ZodEnum<{
1342
1404
  mp4: "mp4";
1343
1405
  gif: "gif";
@@ -1349,6 +1411,15 @@ export declare const OutputFormatSchema: z.ZodEnum<{
1349
1411
 
1350
1412
  export declare const OutputFpsSchema: z.ZodUnion<readonly [z.ZodLiteral<12>, z.ZodLiteral<15>, z.ZodLiteral<23.976>, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<29.97>, z.ZodLiteral<30>, z.ZodLiteral<48>, z.ZodLiteral<50>, z.ZodLiteral<59.94>, z.ZodLiteral<60>]>;
1351
1413
 
1414
+ export declare const OutputResolutionSchema: z.ZodOptional<z.ZodEnum<{
1415
+ preview: "preview";
1416
+ mobile: "mobile";
1417
+ sd: "sd";
1418
+ hd: "hd";
1419
+ 1080: "1080";
1420
+ "4k": "4k";
1421
+ }>>;
1422
+
1352
1423
  export { OutputSchema }
1353
1424
 
1354
1425
  export declare const OutputSizeSchema: z.ZodObject<{
@@ -1856,6 +1927,7 @@ export declare class Timeline extends TimelineEntity {
1856
1927
  private readonly handlePlaybackPause;
1857
1928
  private readonly handleClipSelected;
1858
1929
  private readonly handleClipLoadFailed;
1930
+ private readonly handleRulerMouseMove;
1859
1931
  constructor(edit: Edit, container: HTMLElement, options?: TimelineOptions);
1860
1932
  /** Initialize and mount the timeline */
1861
1933
  load(): Promise<void>;
@@ -2177,6 +2249,8 @@ export declare class UIController {
2177
2249
  readonly mergeFieldsEnabled: boolean;
2178
2250
  /** Whether selection handles are enabled for drag/resize/rotate */
2179
2251
  private readonly selectionHandlesEnabled;
2252
+ /** Maximum total pixels for resolution picker (undefined = unlimited) */
2253
+ private readonly maxPixels?;
2180
2254
  private clipToolbar;
2181
2255
  private toolbarMode;
2182
2256
  private currentAssetType;
@@ -2376,6 +2450,8 @@ export declare interface UIControllerOptions {
2376
2450
  selectionHandles?: boolean;
2377
2451
  /** Enable merge fields UI (Variables panel, autocomplete). Default: false (vanilla video editor) */
2378
2452
  mergeFields?: boolean;
2453
+ /** Maximum total pixels allowed for resolution picker input. Omit for unlimited. */
2454
+ maxPixels?: number;
2379
2455
  }
2380
2456
 
2381
2457
  /**