melies-video-editor 0.1.7 → 0.2.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.
@@ -51,6 +51,15 @@ export type MeliesVideoEditorProps = {
51
51
  * stable asset identifiers if they need cross-session restore.
52
52
  */
53
53
  onFootageImported?: (event: MeliesFootageImportEvent) => void;
54
+ /**
55
+ * Host-facing export hook.
56
+ *
57
+ * When provided, the in-editor Export button will call this callback instead of using
58
+ * the built-in local `/export` POST.
59
+ *
60
+ * The host app should orchestrate export (e.g. S3 presign upload → job start → poll → download).
61
+ */
62
+ onExport?: (event: MeliesExportEvent) => void | Promise<void>;
54
63
  };
55
64
  export type MeliesFootageImportEntry = {
56
65
  /** The bin item added to the footage bin. */
@@ -66,6 +75,34 @@ export type MeliesFootageImportEvent = {
66
75
  /** Convenience list of files. */
67
76
  files: File[];
68
77
  };
78
+ export type MeliesExportAsset = {
79
+ /** The timeline join key for this asset (action.data.src). */
80
+ src: string;
81
+ /** Best-effort classification based on how the asset is used in the timeline. */
82
+ kind: 'video' | 'audio' | 'unknown';
83
+ /** Optional metadata (only available when the editor has seen it this session). */
84
+ name?: string;
85
+ /** Optional metadata (only available when the editor has seen it this session). */
86
+ mimeType?: string;
87
+ };
88
+ export type MeliesExportEvent = {
89
+ /** A deep-cloned snapshot of the current timeline state (safe to persist/mutate). */
90
+ snapshot: MeliesTimelineSnapshot;
91
+ /** Convenience list of unique src keys referenced by the timeline. */
92
+ assetSrcs: string[];
93
+ /** Richer asset list with best-effort metadata. */
94
+ assets: MeliesExportAsset[];
95
+ /**
96
+ * Returns a File for a given src when the editor has access to bytes this session.
97
+ * For stable src keys (e.g. Base44 asset IDs), hosts should resolve bytes themselves.
98
+ */
99
+ getFileBySrc: (src: string) => File | null;
100
+ /** Lists all in-session Files the editor can provide, keyed by src. */
101
+ listSessionFiles: () => Array<{
102
+ src: string;
103
+ file: File;
104
+ }>;
105
+ };
69
106
  export type MeliesTimelineSnapshot = {
70
107
  /** Bump this when snapshot schema changes. */
71
108
  version: 1;
@@ -2,6 +2,12 @@ import type { TimelineEngine } from '@xzdarcy/react-timeline-editor';
2
2
  declare class AudioControl {
3
3
  private howlBySrc;
4
4
  private activeByActionId;
5
+ /**
6
+ * Stop and detach an active sound instance for a given action id.
7
+ *
8
+ * This is a best-effort cleanup helper used by both `stop()` and `reset()`.
9
+ */
10
+ private stopActiveAction;
5
11
  private getHowl;
6
12
  /**
7
13
  * Ensure the underlying WebAudio context is resumed.
@@ -24,6 +30,14 @@ declare class AudioControl {
24
30
  stop(data: {
25
31
  actionId: string;
26
32
  }): void;
33
+ /**
34
+ * Fully reset audio playback state.
35
+ *
36
+ * This is important because `audioControl` is a singleton and action IDs are
37
+ * stable across snapshot restores. Without a reset, we can keep references to
38
+ * revoked blob URLs or previous engine instances, causing silent playback.
39
+ */
40
+ reset(): void;
27
41
  }
28
42
  declare const _default: AudioControl;
29
43
  export default _default;
@@ -1,6 +1,7 @@
1
1
  import type { TimelineState } from '@xzdarcy/react-timeline-editor';
2
+ import type { MeliesExportEvent } from './App';
2
3
  export declare const Rates: number[];
3
- declare const TimelinePlayer: ({ timelineState, autoScrollWhenPlay, scale, scaleWidth, startLeft, editorData, selectedActionId, onDeleteSelectedClip, onSplitSelectedClip, canUndo, canRedo, onUndo, onRedo, }: {
4
+ declare const TimelinePlayer: ({ timelineState, autoScrollWhenPlay, scale, scaleWidth, startLeft, editorData, selectedActionId, onDeleteSelectedClip, onSplitSelectedClip, canUndo, canRedo, onUndo, onRedo, onExport, buildExportEvent, }: {
4
5
  timelineState: React.MutableRefObject<TimelineState | null>;
5
6
  autoScrollWhenPlay: React.MutableRefObject<boolean>;
6
7
  scale: number;
@@ -14,5 +15,7 @@ declare const TimelinePlayer: ({ timelineState, autoScrollWhenPlay, scale, scale
14
15
  canRedo: boolean;
15
16
  onUndo: () => void;
16
17
  onRedo: () => void;
18
+ onExport?: (event: MeliesExportEvent) => void | Promise<void>;
19
+ buildExportEvent?: () => MeliesExportEvent;
17
20
  }) => import("react/jsx-runtime").JSX.Element;
18
21
  export default TimelinePlayer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melies-video-editor",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "A React video timeline editor GUI built on @xzdarcy/react-timeline-editor.",
5
5
  "type": "module",
6
6
  "license": "MIT",