mulmocast 2.4.8 → 2.5.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.
- package/assets/html/js/animation_runtime.js +371 -0
- package/assets/html/js/auto_render.js +64 -0
- package/assets/html/js/data_attribute_registration.js +178 -0
- package/assets/html/tailwind_animated.html +37 -256
- package/lib/actions/image_references.js +1 -1
- package/lib/methods/mulmo_beat.d.ts +2 -0
- package/lib/methods/mulmo_beat.js +5 -0
- package/lib/types/schema.d.ts +42 -0
- package/lib/types/schema.js +2 -0
- package/lib/utils/browser_pool.d.ts +5 -0
- package/lib/utils/browser_pool.js +39 -0
- package/lib/utils/context.d.ts +14 -0
- package/lib/utils/file.d.ts +1 -0
- package/lib/utils/file.js +4 -0
- package/lib/utils/html_render.d.ts +6 -0
- package/lib/utils/html_render.js +33 -0
- package/lib/utils/image_plugins/html_tailwind.js +22 -13
- package/package.json +10 -9
- package/scripts/test/images/qa_landscape.jpg +0 -0
- package/scripts/test/images/qa_portrait.png +0 -0
- package/scripts/test/test_animated.json +592 -0
- package/scripts/test/test_data_animation.json +149 -0
- package/scripts/test/test_html_cover_pan_zoom_landscape_canvas.json +245 -0
- package/scripts/test/test_html_cover_pan_zoom_portrait_canvas.json +207 -0
- package/scripts/test/test_reference_canvas_size.json +83 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import nodePath from "node:path";
|
|
3
3
|
import { MulmoBeatMethods } from "../../methods/mulmo_beat.js";
|
|
4
|
-
import { getHTMLFile } from "../file.js";
|
|
5
|
-
import { renderHTMLToImage, interpolate, renderHTMLToFrames } from "../html_render.js";
|
|
4
|
+
import { getHTMLFile, getJSFile } from "../file.js";
|
|
5
|
+
import { renderHTMLToImage, interpolate, renderHTMLToFrames, renderHTMLToVideo } from "../html_render.js";
|
|
6
6
|
import { framesToVideo } from "../ffmpeg_utils.js";
|
|
7
7
|
import { parrotingImagePath } from "./utils.js";
|
|
8
8
|
export const imageType = "html_tailwind";
|
|
@@ -47,9 +47,9 @@ const getAnimationConfig = (params) => {
|
|
|
47
47
|
const animation = beat.image.animation;
|
|
48
48
|
if (!MulmoBeatMethods.isAnimationEnabled(animation))
|
|
49
49
|
return null;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return { fps
|
|
50
|
+
const fps = MulmoBeatMethods.isAnimationObject(animation) ? (animation.fps ?? DEFAULT_ANIMATION_FPS) : DEFAULT_ANIMATION_FPS;
|
|
51
|
+
const movie = MulmoBeatMethods.isMovieMode(animation);
|
|
52
|
+
return { fps, movie };
|
|
53
53
|
};
|
|
54
54
|
const processHtmlTailwindAnimated = async (params) => {
|
|
55
55
|
const { beat, imagePath, canvasSize, context } = params;
|
|
@@ -72,6 +72,9 @@ const processHtmlTailwindAnimated = async (params) => {
|
|
|
72
72
|
const script = "script" in beat.image ? beat.image.script : undefined;
|
|
73
73
|
const rawHtmlData = interpolate(template, {
|
|
74
74
|
html_body: html,
|
|
75
|
+
animation_runtime: getJSFile("animation_runtime"),
|
|
76
|
+
data_attribute_registration: getJSFile("data_attribute_registration"),
|
|
77
|
+
auto_render: getJSFile("auto_render"),
|
|
75
78
|
user_script: buildUserScript(script),
|
|
76
79
|
totalFrames: String(totalFrames),
|
|
77
80
|
fps: String(fps),
|
|
@@ -81,15 +84,21 @@ const processHtmlTailwindAnimated = async (params) => {
|
|
|
81
84
|
const htmlData = resolveRelativeImagePaths(resolvedRefs, context.fileDirs.mulmoFileDirPath);
|
|
82
85
|
// imagePath is set to the .mp4 path by imagePluginAgent for animated beats
|
|
83
86
|
const videoPath = imagePath;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
await renderHTMLToFrames(htmlData, framesDir, canvasSize.width, canvasSize.height, totalFrames, fps);
|
|
89
|
-
await framesToVideo(framesDir, videoPath, fps, canvasSize.width, canvasSize.height);
|
|
87
|
+
if (animConfig.movie) {
|
|
88
|
+
// CDP screencast: real-time recording (experimental, faster)
|
|
89
|
+
await renderHTMLToVideo(htmlData, videoPath, canvasSize.width, canvasSize.height, totalFrames, fps);
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
else {
|
|
92
|
+
// Frame-by-frame screenshot (deterministic, slower)
|
|
93
|
+
const framesDir = videoPath.replace(/\.[^/.]+$/, "_frames");
|
|
94
|
+
fs.mkdirSync(framesDir, { recursive: true });
|
|
95
|
+
try {
|
|
96
|
+
await renderHTMLToFrames(htmlData, framesDir, canvasSize.width, canvasSize.height, totalFrames, fps);
|
|
97
|
+
await framesToVideo(framesDir, videoPath, fps, canvasSize.width, canvasSize.height);
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
fs.rmSync(framesDir, { recursive: true, force: true });
|
|
101
|
+
}
|
|
93
102
|
}
|
|
94
103
|
return videoPath;
|
|
95
104
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.node.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"resolutions": {
|
|
27
|
-
"minimatch": "^10.2.4"
|
|
27
|
+
"minimatch": "^10.2.4",
|
|
28
|
+
"yauzl": "^3.2.1"
|
|
28
29
|
},
|
|
29
30
|
"bin": {
|
|
30
31
|
"mulmo": "lib/cli/bin.js",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"pdf": "npx tsx ./src/cli/bin.ts pdf",
|
|
57
58
|
"test": "rm -f scratchpad/test*.* && npx tsx ./src/audio.ts scripts/test/test.json && npx tsx ./src/images.ts scripts/test/test.json && npx tsx ./src/movie.ts scripts/test/test.json",
|
|
58
59
|
"ci_test": "cross-env NODE_ENV=test tsx --test --experimental-test-coverage ./test/*/test_*.ts",
|
|
59
|
-
"lint": "eslint src test",
|
|
60
|
+
"lint": "eslint src test assets/html/js",
|
|
60
61
|
"build": "tsc",
|
|
61
62
|
"build_test": "tsc && git checkout -- lib/*",
|
|
62
63
|
"cli": "npx tsx ./src/cli/bin.ts",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"story_to_script": "npx tsx ./src/cli/bin.ts tool story_to_script",
|
|
69
70
|
"whisper": "npx tsx ./src/cli/bin.ts tool whisper",
|
|
70
71
|
"latest": "yarn upgrade-interactive --latest",
|
|
71
|
-
"format": "prettier --write '{src,scripts,assets/templates,assets/styles,draft,ideason,scripts_mag2,proto,test,batch,graphai,output,docs/scripts}/**/*.{ts,json,yaml}'",
|
|
72
|
+
"format": "prettier --write '{src,scripts,assets/templates,assets/styles,assets/html/js,draft,ideason,scripts_mag2,proto,test,batch,graphai,output,docs/scripts}/**/*.{ts,js,json,yaml}'",
|
|
72
73
|
"deep_research": "npx tsx ./src/tools/deep_research.ts",
|
|
73
74
|
"template": "npx tsx batch/template2tsobject.ts && yarn run format",
|
|
74
75
|
"mcp_server": "npx tsx ./src/mcp/server.ts",
|
|
@@ -109,9 +110,9 @@
|
|
|
109
110
|
"graphai": "^2.0.16",
|
|
110
111
|
"jsdom": "^28.1.0",
|
|
111
112
|
"marked": "^17.0.4",
|
|
112
|
-
"mulmocast-vision": "^1.0.
|
|
113
|
+
"mulmocast-vision": "^1.0.9",
|
|
113
114
|
"ora": "^9.3.0",
|
|
114
|
-
"puppeteer": "^24.
|
|
115
|
+
"puppeteer": "^24.39.1",
|
|
115
116
|
"replicate": "^1.4.0",
|
|
116
117
|
"yaml": "^2.8.2",
|
|
117
118
|
"yargs": "^18.0.0",
|
|
@@ -125,15 +126,15 @@
|
|
|
125
126
|
"@types/jsdom": "^28.0.0",
|
|
126
127
|
"@types/yargs": "^17.0.35",
|
|
127
128
|
"cross-env": "^10.1.0",
|
|
128
|
-
"eslint": "^10.0.
|
|
129
|
+
"eslint": "^10.0.3",
|
|
129
130
|
"eslint-config-prettier": "^10.1.8",
|
|
130
131
|
"eslint-plugin-prettier": "^5.5.5",
|
|
131
|
-
"eslint-plugin-sonarjs": "^4.0.
|
|
132
|
+
"eslint-plugin-sonarjs": "^4.0.2",
|
|
132
133
|
"globals": "^17.4.0",
|
|
133
134
|
"prettier": "^3.8.1",
|
|
134
135
|
"tsx": "^4.21.0",
|
|
135
136
|
"typescript": "6.0.0-beta",
|
|
136
|
-
"typescript-eslint": "^8.
|
|
137
|
+
"typescript-eslint": "^8.57.0"
|
|
137
138
|
},
|
|
138
139
|
"engines": {
|
|
139
140
|
"node": ">=22.0.0"
|
|
Binary file
|
|
Binary file
|