@vibeframe/cli 0.115.8 → 0.115.9
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/commands/_shared/lottie.d.ts +40 -0
- package/dist/commands/_shared/lottie.test.d.ts +1 -0
- package/dist/commands/_shared/scene-html-emit.d.ts +8 -9
- package/dist/commands/_shared/scene-lottie.integration.test.d.ts +1 -0
- package/dist/commands/edit/lottie-overlay.d.ts +2 -13
- package/dist/index.js +784 -755
- package/dist/tools/manifest/index.js +636 -607
- package/package.json +3 -3
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module _shared/lottie
|
|
3
|
+
*
|
|
4
|
+
* Pieces shared by the two places VibeFrame draws a Lottie animation in a
|
|
5
|
+
* Hyperframes page: `vibe edit motion-overlay --asset` (a standalone layer
|
|
6
|
+
* page) and `vibe scene add --lottie` (a canvas inside a scene).
|
|
7
|
+
*
|
|
8
|
+
* Both drive a dotLottie player frame by frame from the render's seek
|
|
9
|
+
* instead of letting it autoplay, so every captured frame is the frame for
|
|
10
|
+
* that time. Both load the runtime from files copied next to the page, not
|
|
11
|
+
* from a CDN, so a render works offline and never depends on the network.
|
|
12
|
+
*/
|
|
13
|
+
export type LottiePosition = "full" | "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
14
|
+
export declare const LOTTIE_POSITIONS: readonly LottiePosition[];
|
|
15
|
+
/** Reject files dotLottie cannot open before spending a browser render on them. */
|
|
16
|
+
export declare function checkLottieAsset(path: string): Promise<string | undefined>;
|
|
17
|
+
/** CSS box for the overlay canvas, in pixels of the layer. */
|
|
18
|
+
export declare function overlayBox(layer: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}, position: LottiePosition, scale: number): {
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
/** File names of the dotLottie runtime inside the vendor directory. */
|
|
28
|
+
export declare const DOTLOTTIE_SCRIPT = "dotlottie-web.js";
|
|
29
|
+
export declare const DOTLOTTIE_WASM = "dotlottie-player.wasm";
|
|
30
|
+
/** Copy the dotLottie runtime (ESM build plus its WASM) into `dir`. */
|
|
31
|
+
export declare function copyDotLottieRuntime(dir: string): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Browser-side JavaScript: `loadDotLottie(vendorDir)` imports the runtime
|
|
34
|
+
* from a directory relative to the page and points it at the WASM, and
|
|
35
|
+
* `setLottieTime(player, t, loop)` shows the frame for `t` seconds.
|
|
36
|
+
* The render server sends .wasm without application/wasm, which makes
|
|
37
|
+
* WebAssembly.instantiateStreaming reject it, so the WASM goes through a
|
|
38
|
+
* typed Blob URL.
|
|
39
|
+
*/
|
|
40
|
+
export declare const DOTLOTTIE_BROWSER_HELPERS = "async function loadDotLottie(vendorDir) {\n const url = (file) => new URL(vendorDir + \"/\" + file, document.baseURI).href;\n const { DotLottie } = await import(url(\"dotlottie-web.js\"));\n const wasm = await (await fetch(url(\"dotlottie-player.wasm\"))).arrayBuffer();\n DotLottie.setWasmUrl(URL.createObjectURL(new Blob([wasm], { type: \"application/wasm\" })));\n return DotLottie;\n }\n function setLottieTime(player, t, loop) {\n const length = player.duration;\n const frames = player.totalFrames;\n if (!(length > 0) || !(frames > 0)) return;\n const local = Math.max(0, Number(t) || 0);\n const at = loop ? local % length : Math.min(local, length);\n player.setFrame(Math.min(frames - 1, (at / length) * frames));\n }";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* Pure functions only — no I/O. The orchestrating command (`scene add`) wires
|
|
16
16
|
* these to the filesystem.
|
|
17
17
|
*/
|
|
18
|
+
import { LOTTIE_POSITIONS, type LottiePosition } from "./lottie.js";
|
|
18
19
|
export type ScenePreset = "simple" | "announcement" | "explainer" | "kinetic-type" | "product-shot";
|
|
19
20
|
export declare const SCENE_PRESETS: readonly ScenePreset[];
|
|
20
21
|
/**
|
|
@@ -27,12 +28,9 @@ export interface SceneTranscriptWord {
|
|
|
27
28
|
start: number;
|
|
28
29
|
end: number;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
export type LottiePosition = "full" | "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
35
|
-
export declare const LOTTIE_POSITIONS: readonly LottiePosition[];
|
|
31
|
+
export { LOTTIE_POSITIONS, type LottiePosition };
|
|
32
|
+
/** Project-relative directory `vibe scene add --lottie` copies the dotLottie runtime into. */
|
|
33
|
+
export declare const LOTTIE_RUNTIME_DIR = "assets/vendor/dotlottie";
|
|
36
34
|
export interface LottieOverlayInput {
|
|
37
35
|
/** Project-relative path to the `.json` or `.lottie` file (e.g. "assets/logo.lottie"). */
|
|
38
36
|
src: string;
|
|
@@ -74,9 +72,10 @@ export interface EmitSceneInput {
|
|
|
74
72
|
*/
|
|
75
73
|
transcript?: SceneTranscriptWord[];
|
|
76
74
|
/**
|
|
77
|
-
* Optional Lottie animation overlay
|
|
78
|
-
*
|
|
79
|
-
*
|
|
75
|
+
* Optional Lottie animation overlay, drawn on a canvas above the preset's
|
|
76
|
+
* content. Uses the same position/scale/opacity vocabulary as
|
|
77
|
+
* `vibe edit motion-overlay`. Needs the dotLottie runtime in
|
|
78
|
+
* {@link LOTTIE_RUNTIME_DIR}.
|
|
80
79
|
*/
|
|
81
80
|
lottie?: LottieOverlayInput;
|
|
82
81
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* 2. FFmpeg overlays that layer onto the original video at `start`,
|
|
13
13
|
* keeping the source resolution, frame rate, and audio.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
import { type LottiePosition } from "../_shared/lottie.js";
|
|
16
|
+
export type { LottiePosition };
|
|
16
17
|
export interface LottieOverlayOptions {
|
|
17
18
|
videoPath: string;
|
|
18
19
|
assetPath: string;
|
|
@@ -43,18 +44,6 @@ export interface VideoStreamInfo {
|
|
|
43
44
|
}
|
|
44
45
|
/** Probe the first video stream. Width/height are swapped for 90/270 degree rotations, as FFmpeg autorotates on decode. */
|
|
45
46
|
export declare function probeVideoStream(path: string): Promise<VideoStreamInfo>;
|
|
46
|
-
/** Reject files dotLottie cannot open before spending a browser render on them. */
|
|
47
|
-
export declare function checkLottieAsset(path: string): Promise<string | undefined>;
|
|
48
|
-
/** CSS box for the overlay canvas, in pixels of the layer. */
|
|
49
|
-
export declare function overlayBox(layer: {
|
|
50
|
-
width: number;
|
|
51
|
-
height: number;
|
|
52
|
-
}, position: LottiePosition, scale: number): {
|
|
53
|
-
left: number;
|
|
54
|
-
top: number;
|
|
55
|
-
width: number;
|
|
56
|
-
height: number;
|
|
57
|
-
};
|
|
58
47
|
/**
|
|
59
48
|
* The layer page. `window.__hf` is published only after the animation has
|
|
60
49
|
* loaded, because the producer starts capturing once `__hf.duration > 0`.
|