melies-video-editor 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melies-video-editor",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A React video timeline editor GUI built on @xzdarcy/react-timeline-editor.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,33 +0,0 @@
1
- import './index.less';
2
- export type MeliesVideoEditorProps = {
3
- /**
4
- * URLs (often blob: URLs) to show in the footage bin.
5
- * When omitted or empty, the footage bin will be empty.
6
- */
7
- footageUrls?: string[];
8
- /**
9
- * Local Files to show in the footage bin.
10
- *
11
- * This is ideal for OPFS (Base44 can load from OPFS and pass `File`s here).
12
- */
13
- footageFiles?: File[];
14
- /**
15
- * Handle-like objects (e.g. `FileSystemFileHandle`) that can yield `File`s.
16
- *
17
- * We intentionally avoid depending on `FileSystemFileHandle` directly so
18
- * consumers without that DOM lib type can still compile.
19
- */
20
- footageFileHandles?: Array<{
21
- getFile: () => Promise<File>;
22
- name?: string;
23
- }>;
24
- /**
25
- * When true, automatically place `footageUrls` onto the timeline on first initialization
26
- * (one after another, starting at t=0).
27
- *
28
- * Defaults to false.
29
- */
30
- autoPlaceFootage?: boolean;
31
- };
32
- declare const MeliesVideoEditor: ({ footageUrls, footageFiles, footageFileHandles, autoPlaceFootage, }: MeliesVideoEditorProps) => import("react/jsx-runtime").JSX.Element;
33
- export default MeliesVideoEditor;
@@ -1,29 +0,0 @@
1
- import type { TimelineEngine } from '@xzdarcy/react-timeline-editor';
2
- declare class AudioControl {
3
- private howlBySrc;
4
- private activeByActionId;
5
- private getHowl;
6
- /**
7
- * Ensure the underlying WebAudio context is resumed.
8
- *
9
- * Some browsers (notably iOS Safari) block audio playback until a user gesture
10
- * resumes the AudioContext. Timeline engine callbacks may occur outside the
11
- * original gesture call stack, so we explicitly unlock in the toolbar handler.
12
- */
13
- unlock(): void;
14
- warm(src: string): void;
15
- private seekForEngineTime;
16
- start(data: {
17
- actionId: string;
18
- engine: TimelineEngine;
19
- src: string;
20
- startTime: number;
21
- time: number;
22
- offset?: number;
23
- }): void;
24
- stop(data: {
25
- actionId: string;
26
- }): void;
27
- }
28
- declare const _default: AudioControl;
29
- export default _default;
@@ -1,14 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { CustomTimelineAction, CusTomTimelineRow } from './mock';
3
- export declare const CustomRender0: FC<{
4
- action: CustomTimelineAction;
5
- row: CusTomTimelineRow;
6
- }>;
7
- export declare const CustomRender1: FC<{
8
- action: CustomTimelineAction;
9
- row: CusTomTimelineRow;
10
- }>;
11
- export declare const CustomRender2: FC<{
12
- action: CustomTimelineAction;
13
- row: CusTomTimelineRow;
14
- }>;
@@ -1,4 +0,0 @@
1
- export default function DevRoot({ defaultFootageUrls, useHostShell, }: {
2
- defaultFootageUrls?: string[];
3
- useHostShell: boolean;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- export default function HostApp({ footageUrls, footageFiles, footageFileHandles, }: {
2
- footageUrls?: string[];
3
- footageFiles?: File[];
4
- footageFileHandles?: Array<{
5
- getFile: () => Promise<File>;
6
- name?: string;
7
- }>;
8
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- export type FootageItem = {
2
- id: string;
3
- kind: 'video' | 'audio';
4
- name: string;
5
- src: string;
6
- /** Optional lower-res/proxy source for smooth preview playback. */
7
- previewSrc?: string;
8
- defaultDuration?: number;
9
- };
10
- export declare const FOOTAGE_BIN: FootageItem[];
11
- export declare const VIDEO_ITEMS: FootageItem[];
12
- export declare const AUDIO_ITEMS: FootageItem[];
@@ -1 +0,0 @@
1
- import 'antd/dist/antd.css';
@@ -1,3 +0,0 @@
1
- export { default as MeliesVideoEditor } from '../App';
2
- export type { MeliesVideoEditorProps } from '../App';
3
- export type { TimelineAction, TimelineEffect, TimelineRow, TimelineState, } from '@xzdarcy/react-timeline-editor';
@@ -1,28 +0,0 @@
1
- import { type AnimationItem } from 'lottie-web';
2
- declare class LottieControl {
3
- cacheMap: Record<string, AnimationItem>;
4
- private _goToAndStop;
5
- enter(data: {
6
- id: string;
7
- src: string;
8
- startTime: number;
9
- endTime: number;
10
- time: number;
11
- }): void;
12
- update(data: {
13
- id: string;
14
- src: string;
15
- startTime: number;
16
- endTime: number;
17
- time: number;
18
- }): void;
19
- leave(data: {
20
- id: string;
21
- startTime: number;
22
- endTime: number;
23
- time: number;
24
- }): void;
25
- destroy(): void;
26
- }
27
- declare const _default: LottieControl;
28
- export default _default;
@@ -1,80 +0,0 @@
1
- type MediaKind = 'video' | 'audio' | 'other';
2
- export type ProxyEvent = {
3
- type: 'proxy-start';
4
- originalSrc: string;
5
- } | {
6
- type: 'proxy-progress';
7
- originalSrc: string;
8
- value?: number;
9
- status?: string;
10
- } | {
11
- type: 'proxy-ready';
12
- originalSrc: string;
13
- proxySrc: string;
14
- } | {
15
- type: 'proxy-failed';
16
- originalSrc: string;
17
- error: string;
18
- };
19
- declare const guessKind: (src: string) => MediaKind;
20
- declare class MediaCache {
21
- private blobUrlBySrc;
22
- private pendingBySrc;
23
- private metaBySrc;
24
- private proxyEventListeners;
25
- /** Subscribe to proxy generation events (useful for UI debug on mobile where console logs aren't visible). */
26
- onProxyEvent(listener: (event: ProxyEvent) => void): () => void;
27
- private emitProxyEvent;
28
- registerSrcMeta(src: string, meta: {
29
- name?: string;
30
- mimeType?: string;
31
- }): void;
32
- getSrcMeta(src: string): {
33
- name?: string;
34
- mimeType?: string;
35
- } | undefined;
36
- /**
37
- * Ingests a File object into OPFS.
38
- * Returns a virtual 'opfs://' URL that can be used as a src reference.
39
- */
40
- ingest(file: File): Promise<string>;
41
- private initProxy;
42
- /**
43
- * Returns a URL that is safe to assign to a media element (`<video>`/`<audio>`).
44
- *
45
- * Notes:
46
- * - `opfs://...` is NOT directly playable by browsers.
47
- * - For OPFS sources, this will kick off an async preload (creating a `blob:` URL) and return `undefined`.
48
- */
49
- resolveForMediaElement(src: string): string | undefined;
50
- /**
51
- * Helper to fetch a file from OPFS given an opfs:// URL
52
- */
53
- getFileFromOpfs(opfsUrl: string): Promise<File | undefined>;
54
- /**
55
- * Preloads a URL into memory and returns a blob: URL.
56
- * Useful to avoid runtime buffering/stalls when seeking frequently.
57
- */
58
- preloadToBlobUrl(src: string): Promise<string>;
59
- /** Returns a blob URL if available, otherwise the original `src`. */
60
- resolve(src: string): string;
61
- /** Starts preload in background (non-blocking). */
62
- warm(src: string): void;
63
- /**
64
- * Preload a list of srcs with bounded concurrency.
65
- *
66
- * This is useful when you know ahead of time which assets will be scrubbed/seeked,
67
- * so we can eliminate network stalls during interaction.
68
- */
69
- warmAll(srcs: Iterable<string>, opts?: {
70
- /** Maximum number of concurrent fetches. Defaults to 3. */
71
- concurrency?: number;
72
- /** Yield back to the event loop between items. Defaults to true. */
73
- yieldBetween?: boolean;
74
- }): Promise<void>;
75
- /** Convenience: preload all unique action.data.src from editor data. */
76
- warmFromEditorData(editorData: unknown): void;
77
- }
78
- declare const mediaCache: MediaCache;
79
- export default mediaCache;
80
- export { guessKind };
@@ -1,25 +0,0 @@
1
- import type { TimelineAction, TimelineEffect, TimelineRow } from '@xzdarcy/react-timeline-editor';
2
- export declare const scaleWidth = 160;
3
- export declare const scale = 5;
4
- export declare const startLeft = 20;
5
- export interface CustomTimelineAction extends TimelineAction {
6
- data: {
7
- src: string;
8
- previewSrc?: string;
9
- name: string;
10
- /** Video lane index (0=V1, 1=V2). Higher value wins when overlapping. */
11
- videoLayer?: number;
12
- /** Shared id for clips that should move/trim together (e.g. video + its embedded audio). */
13
- linkId?: string;
14
- /**
15
- * In-point offset into the underlying media (seconds).
16
- * Used for split clips so the right segment continues from the correct time.
17
- */
18
- offset?: number;
19
- };
20
- }
21
- export interface CusTomTimelineRow extends TimelineRow {
22
- actions: CustomTimelineAction[];
23
- }
24
- export declare const mockEffect: Record<string, TimelineEffect>;
25
- export declare const mockData: CusTomTimelineRow[];
@@ -1,18 +0,0 @@
1
- import type { TimelineState } from '@xzdarcy/react-timeline-editor';
2
- export declare const Rates: number[];
3
- declare const TimelinePlayer: ({ timelineState, autoScrollWhenPlay, scale, scaleWidth, startLeft, editorData, selectedActionId, onDeleteSelectedClip, onSplitSelectedClip, canUndo, canRedo, onUndo, onRedo, }: {
4
- timelineState: React.MutableRefObject<TimelineState | null>;
5
- autoScrollWhenPlay: React.MutableRefObject<boolean>;
6
- scale: number;
7
- scaleWidth: number;
8
- startLeft: number;
9
- editorData: any[];
10
- selectedActionId: string | null;
11
- onDeleteSelectedClip: () => void;
12
- onSplitSelectedClip: () => void;
13
- canUndo: boolean;
14
- canRedo: boolean;
15
- onUndo: () => void;
16
- onRedo: () => void;
17
- }) => import("react/jsx-runtime").JSX.Element;
18
- export default TimelinePlayer;
@@ -1,37 +0,0 @@
1
- export type OpfsRoot = FileSystemDirectoryHandle;
2
- export declare const ensureOpfsRoot: () => Promise<OpfsRoot>;
3
- export declare const ensureDir: (root: OpfsRoot, path: string) => Promise<FileSystemDirectoryHandle>;
4
- /**
5
- * Writes a Blob or File to OPFS.
6
- * Uses createWritable() which is the standard async way to write.
7
- */
8
- export declare const writeFileToOpfs: (opts: {
9
- root: OpfsRoot;
10
- dirPath: string;
11
- fileName: string;
12
- file: Blob | File;
13
- }) => Promise<{
14
- fileHandle: FileSystemFileHandle;
15
- path: string;
16
- }>;
17
- export declare const getOpfsFile: (path: string) => Promise<File | undefined>;
18
- export declare const listFiles: (opts: {
19
- root: OpfsRoot;
20
- dirPath: string;
21
- }) => Promise<FileSystemFileHandle[]>;
22
- export declare const clearDir: (opts: {
23
- root: OpfsRoot;
24
- dirPath: string;
25
- }) => Promise<void>;
26
- type Maybe<T> = T | null | undefined;
27
- export declare const getFileFromPublicUrl: (url: string, fallbackName?: Maybe<string>) => Promise<File>;
28
- export declare const writeBlobToOpfs: (opts: {
29
- root: OpfsRoot;
30
- dirPath: string;
31
- fileName: string;
32
- blob: Blob;
33
- }) => Promise<{
34
- fileHandle: FileSystemFileHandle;
35
- path: string;
36
- }>;
37
- export {};
@@ -1,19 +0,0 @@
1
- declare class ProxyManager {
2
- private activeJobs;
3
- /**
4
- * Create (or reuse) a proxy file for an OPFS video.
5
- *
6
- * `originalOpfsPath` should be an `opfs://...` URL.
7
- */
8
- createProxy(originalOpfsPath: string, opts?: {
9
- onProgress?: (info: {
10
- value?: number;
11
- status?: string;
12
- }) => void;
13
- }): Promise<string>;
14
- private _runWorker;
15
- private getHandle;
16
- private ensureDir;
17
- }
18
- export declare const proxyManager: ProxyManager;
19
- export {};
@@ -1 +0,0 @@
1
- export declare function useCoarsePointer(): boolean;
@@ -1,71 +0,0 @@
1
- import type { TimelineEngine, TimelineRow } from '@xzdarcy/react-timeline-editor';
2
- declare class VideoControl {
3
- private primaryEl;
4
- private secondaryEl;
5
- private activeEl;
6
- private rowData;
7
- private boundEngine;
8
- private vfcHandle;
9
- private rafHandle;
10
- private isPlaying;
11
- private playbackRate;
12
- private lastVideoClip;
13
- private lastKnownTime;
14
- constructor();
15
- /**
16
- * Called by App.tsx to provide the two video elements.
17
- */
18
- attachPrimary(el: HTMLVideoElement | null): void;
19
- attachSecondary(el: HTMLVideoElement | null): void;
20
- /**
21
- * Helper to set initial styling/events for video elements.
22
- */
23
- private initElement;
24
- /**
25
- * Deprecated single-element attach, mapped to primary for safety.
26
- */
27
- attach(el: HTMLVideoElement | null): void;
28
- /**
29
- * Called by App.tsx whenever timeline data changes.
30
- */
31
- setEditorData(data: TimelineRow[]): void;
32
- /**
33
- * We use claimVideo to drive the dual-buffer logic from the engine's time updates.
34
- * This ensures we sync to the engine's clock (Slave Mode).
35
- */
36
- claimVideo(data: {
37
- isPlaying?: boolean;
38
- time?: number;
39
- [key: string]: unknown;
40
- }): void;
41
- bindEngine(engine: TimelineEngine): void;
42
- unbindEngine(): void;
43
- private startLoop;
44
- private stopLoop;
45
- /**
46
- * The main heart beat.
47
- * - If playing: sync engine time to video time.
48
- * - Always: Check schedule (what should be playing vs preloading).
49
- */
50
- private tickLoop;
51
- /**
52
- * Evaluate the timeline at `time` (and `time + lookahead`).
53
- * Manage Primary/Secondary elements.
54
- */
55
- private updateState;
56
- private makeActive;
57
- private loadVideo;
58
- private isLoaded;
59
- private findClipAtTime;
60
- private findNextVideoClipStartAfter;
61
- private findNextVideoClipAfter;
62
- play(): void;
63
- pause(): void;
64
- setRate(rate: number): void;
65
- seek(time: number): void;
66
- warm(src: string): void;
67
- releaseVideo(_actionId: string): void;
68
- setActive(_active: boolean): void;
69
- }
70
- declare const _default: VideoControl;
71
- export default _default;
@@ -1 +0,0 @@
1
- export {};