mulmocast 2.5.0 → 2.6.1
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/lib/actions/image_agents.d.ts +1 -0
- package/lib/actions/image_agents.js +2 -2
- package/lib/actions/image_references.d.ts +6 -0
- package/lib/actions/image_references.js +14 -2
- package/lib/actions/images.d.ts +4 -0
- package/lib/actions/images.js +8 -2
- package/lib/types/schema.d.ts +120 -5
- package/lib/types/schema.js +73 -3
- package/lib/types/type.d.ts +3 -1
- package/lib/utils/context.d.ts +64 -26
- package/lib/utils/html_render.js +65 -0
- package/lib/utils/image_plugins/html_tailwind.d.ts +5 -0
- package/lib/utils/image_plugins/html_tailwind.js +48 -9
- package/lib/utils/image_plugins/markdown.js +4 -1
- package/lib/utils/swipe_to_html.d.ts +55 -0
- package/lib/utils/swipe_to_html.js +240 -0
- package/package.json +1 -1
- package/scripts/test/macoro_anime_proto.json +120 -0
- package/scripts/test/macoro_swipe_proto.json +104 -0
- package/scripts/test/macoro_swipe_rich.json +820 -0
- package/scripts/test/test_markdown_image_refs.json +59 -0
- package/scripts/test/test_movie_refs.json +126 -0
|
@@ -60,6 +60,7 @@ export declare const imagePluginAgent: (namedInputs: {
|
|
|
60
60
|
beat: MulmoBeat;
|
|
61
61
|
index: number;
|
|
62
62
|
imageRefs?: Record<string, string>;
|
|
63
|
+
movieRefs?: Record<string, string>;
|
|
63
64
|
}) => Promise<void>;
|
|
64
65
|
export declare const htmlImageGeneratorAgent: (namedInputs: {
|
|
65
66
|
file: string;
|
|
@@ -115,7 +115,7 @@ export const imagePreprocessAgent = async (namedInputs) => {
|
|
|
115
115
|
return { ...returnValue, imagePath, referenceImageForMovie: imagePath, imageAgentInfo, prompt, referenceImages };
|
|
116
116
|
};
|
|
117
117
|
export const imagePluginAgent = async (namedInputs) => {
|
|
118
|
-
const { context, beat, index, imageRefs } = namedInputs;
|
|
118
|
+
const { context, beat, index, imageRefs, movieRefs } = namedInputs;
|
|
119
119
|
const { imagePath } = getBeatPngImagePath(context, index);
|
|
120
120
|
const plugin = MulmoBeatMethods.getPlugin(beat);
|
|
121
121
|
// For animated html_tailwind, use the .mp4 path so the plugin writes video there
|
|
@@ -125,7 +125,7 @@ export const imagePluginAgent = async (namedInputs) => {
|
|
|
125
125
|
MulmoStudioContextMethods.setBeatSessionState(context, "image", index, beat.id, true);
|
|
126
126
|
const studioBeat = context.studio.beats[index];
|
|
127
127
|
const beatDuration = beat.duration ?? studioBeat?.duration;
|
|
128
|
-
const processorParams = { beat, context, imagePath: effectiveImagePath, imageRefs, beatDuration, ...htmlStyle(context, beat) };
|
|
128
|
+
const processorParams = { beat, context, imagePath: effectiveImagePath, imageRefs, movieRefs, beatDuration, ...htmlStyle(context, beat) };
|
|
129
129
|
await plugin.process(processorParams);
|
|
130
130
|
MulmoStudioContextMethods.setBeatSessionState(context, "image", index, beat.id, false);
|
|
131
131
|
}
|
|
@@ -6,4 +6,10 @@ export declare const generateReferenceImage: (inputs: {
|
|
|
6
6
|
image: MulmoImagePromptMedia;
|
|
7
7
|
force?: boolean;
|
|
8
8
|
}) => Promise<string>;
|
|
9
|
+
export type MediaRefs = {
|
|
10
|
+
imageRefs: Record<string, string>;
|
|
11
|
+
movieRefs: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
export declare const getMediaRefs: (context: MulmoStudioContext) => Promise<MediaRefs>;
|
|
14
|
+
/** @deprecated Use getMediaRefs instead */
|
|
9
15
|
export declare const getImageRefs: (context: MulmoStudioContext) => Promise<Record<string, string>>;
|
|
@@ -51,12 +51,13 @@ export const generateReferenceImage = async (inputs) => {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
export const
|
|
54
|
+
export const getMediaRefs = async (context) => {
|
|
55
55
|
const images = context.presentationStyle.imageParams?.images;
|
|
56
56
|
if (!images) {
|
|
57
|
-
return {};
|
|
57
|
+
return { imageRefs: {}, movieRefs: {} };
|
|
58
58
|
}
|
|
59
59
|
const imageRefs = {};
|
|
60
|
+
const movieRefs = {};
|
|
60
61
|
await Promise.all(Object.keys(images)
|
|
61
62
|
.sort()
|
|
62
63
|
.map(async (key, index) => {
|
|
@@ -67,6 +68,17 @@ export const getImageRefs = async (context) => {
|
|
|
67
68
|
else if (image.type === "image") {
|
|
68
69
|
imageRefs[key] = await MulmoMediaSourceMethods.imageReference(image.source, context, key);
|
|
69
70
|
}
|
|
71
|
+
else if (image.type === "movie") {
|
|
72
|
+
movieRefs[key] = await resolveMovieReference(image, context, key);
|
|
73
|
+
}
|
|
70
74
|
}));
|
|
75
|
+
return { imageRefs, movieRefs };
|
|
76
|
+
};
|
|
77
|
+
const resolveMovieReference = async (movie, context, key) => {
|
|
78
|
+
return MulmoMediaSourceMethods.imageReference(movie.source, context, key);
|
|
79
|
+
};
|
|
80
|
+
/** @deprecated Use getMediaRefs instead */
|
|
81
|
+
export const getImageRefs = async (context) => {
|
|
82
|
+
const { imageRefs } = await getMediaRefs(context);
|
|
71
83
|
return imageRefs;
|
|
72
84
|
};
|
package/lib/actions/images.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const beat_graph_data: {
|
|
|
7
7
|
context: {};
|
|
8
8
|
htmlImageAgentInfo: {};
|
|
9
9
|
imageRefs: {};
|
|
10
|
+
movieRefs: {};
|
|
10
11
|
beat: {};
|
|
11
12
|
__mapIndex: {};
|
|
12
13
|
forceMovie: {
|
|
@@ -154,6 +155,7 @@ export declare const beat_graph_data: {
|
|
|
154
155
|
beat: string;
|
|
155
156
|
index: string;
|
|
156
157
|
imageRefs: string;
|
|
158
|
+
movieRefs: string;
|
|
157
159
|
};
|
|
158
160
|
};
|
|
159
161
|
imagePlugin: {
|
|
@@ -164,12 +166,14 @@ export declare const beat_graph_data: {
|
|
|
164
166
|
beat: import("../types/type.js").MulmoBeat;
|
|
165
167
|
index: number;
|
|
166
168
|
imageRefs?: Record<string, string>;
|
|
169
|
+
movieRefs?: Record<string, string>;
|
|
167
170
|
}) => Promise<void>;
|
|
168
171
|
inputs: {
|
|
169
172
|
context: string;
|
|
170
173
|
beat: string;
|
|
171
174
|
index: string;
|
|
172
175
|
imageRefs: string;
|
|
176
|
+
movieRefs: string;
|
|
173
177
|
onComplete: string[];
|
|
174
178
|
};
|
|
175
179
|
};
|
package/lib/actions/images.js
CHANGED
|
@@ -14,7 +14,7 @@ import { fileCacheAgentFilter } from "../utils/filters.js";
|
|
|
14
14
|
import { settings2GraphAIConfig } from "../utils/utils.js";
|
|
15
15
|
import { audioCheckerError } from "../utils/error_cause.js";
|
|
16
16
|
import { extractImageFromMovie, ffmpegGetMediaDuration, trimMusic } from "../utils/ffmpeg_utils.js";
|
|
17
|
-
import {
|
|
17
|
+
import { getMediaRefs } from "./image_references.js";
|
|
18
18
|
import { imagePreprocessAgent, imagePluginAgent, htmlImageGeneratorAgent } from "./image_agents.js";
|
|
19
19
|
const vanillaAgents = vanilla.default ?? vanilla;
|
|
20
20
|
const imageAgents = {
|
|
@@ -52,6 +52,7 @@ export const beat_graph_data = {
|
|
|
52
52
|
context: {},
|
|
53
53
|
htmlImageAgentInfo: {},
|
|
54
54
|
imageRefs: {},
|
|
55
|
+
movieRefs: {},
|
|
55
56
|
beat: {},
|
|
56
57
|
__mapIndex: {},
|
|
57
58
|
forceMovie: { value: false },
|
|
@@ -66,6 +67,7 @@ export const beat_graph_data = {
|
|
|
66
67
|
beat: ":beat",
|
|
67
68
|
index: ":__mapIndex",
|
|
68
69
|
imageRefs: ":imageRefs",
|
|
70
|
+
movieRefs: ":movieRefs",
|
|
69
71
|
},
|
|
70
72
|
},
|
|
71
73
|
imagePlugin: {
|
|
@@ -77,6 +79,7 @@ export const beat_graph_data = {
|
|
|
77
79
|
beat: ":beat",
|
|
78
80
|
index: ":__mapIndex",
|
|
79
81
|
imageRefs: ":imageRefs",
|
|
82
|
+
movieRefs: ":movieRefs",
|
|
80
83
|
onComplete: [":preprocessor"],
|
|
81
84
|
},
|
|
82
85
|
},
|
|
@@ -334,6 +337,7 @@ export const images_graph_data = {
|
|
|
334
337
|
htmlImageAgentInfo: {},
|
|
335
338
|
outputStudioFilePath: {},
|
|
336
339
|
imageRefs: {},
|
|
340
|
+
movieRefs: {},
|
|
337
341
|
map: {
|
|
338
342
|
agent: "mapAgent",
|
|
339
343
|
inputs: {
|
|
@@ -341,6 +345,7 @@ export const images_graph_data = {
|
|
|
341
345
|
context: ":context",
|
|
342
346
|
htmlImageAgentInfo: ":htmlImageAgentInfo",
|
|
343
347
|
imageRefs: ":imageRefs",
|
|
348
|
+
movieRefs: ":movieRefs",
|
|
344
349
|
},
|
|
345
350
|
isResult: true,
|
|
346
351
|
params: {
|
|
@@ -436,13 +441,14 @@ const prepareGenerateImages = async (context) => {
|
|
|
436
441
|
mkdir(imageProjectDirPath);
|
|
437
442
|
const provider = MulmoPresentationStyleMethods.getText2ImageProvider(context.presentationStyle.imageParams?.provider);
|
|
438
443
|
const htmlImageAgentInfo = MulmoPresentationStyleMethods.getHtmlImageAgentInfo(context.presentationStyle);
|
|
439
|
-
const imageRefs = await
|
|
444
|
+
const { imageRefs, movieRefs } = await getMediaRefs(context);
|
|
440
445
|
GraphAILogger.info(`text2image: provider=${provider} model=${context.presentationStyle.imageParams?.model}`);
|
|
441
446
|
const injections = {
|
|
442
447
|
context,
|
|
443
448
|
htmlImageAgentInfo,
|
|
444
449
|
outputStudioFilePath: getOutputStudioFilePath(outDirPath, fileName),
|
|
445
450
|
imageRefs,
|
|
451
|
+
movieRefs,
|
|
446
452
|
};
|
|
447
453
|
return injections;
|
|
448
454
|
};
|
package/lib/types/schema.d.ts
CHANGED
|
@@ -276,6 +276,19 @@ export declare const mulmoImageMediaSchema: z.ZodObject<{
|
|
|
276
276
|
path: z.ZodString;
|
|
277
277
|
}, z.core.$strict>], "kind">;
|
|
278
278
|
}, z.core.$strict>;
|
|
279
|
+
export declare const mulmoMovieMediaSchema: z.ZodObject<{
|
|
280
|
+
type: z.ZodLiteral<"movie">;
|
|
281
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
282
|
+
kind: z.ZodLiteral<"url">;
|
|
283
|
+
url: z.ZodURL;
|
|
284
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
285
|
+
kind: z.ZodLiteral<"base64">;
|
|
286
|
+
data: z.ZodString;
|
|
287
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
288
|
+
kind: z.ZodLiteral<"path">;
|
|
289
|
+
path: z.ZodString;
|
|
290
|
+
}, z.core.$strict>], "kind">;
|
|
291
|
+
}, z.core.$strict>;
|
|
279
292
|
export declare const mulmoTextSlideMediaSchema: z.ZodObject<{
|
|
280
293
|
type: z.ZodLiteral<"textSlide">;
|
|
281
294
|
slide: z.ZodObject<{
|
|
@@ -372,14 +385,16 @@ export declare const mulmoMermaidMediaSchema: z.ZodObject<{
|
|
|
372
385
|
opacity: z.ZodOptional<z.ZodNumber>;
|
|
373
386
|
}, z.core.$strip>]>>>;
|
|
374
387
|
}, z.core.$strict>;
|
|
388
|
+
export declare const swipeElementSchema: z.ZodType;
|
|
375
389
|
export declare const htmlTailwindAnimationSchema: z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
376
390
|
fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
377
391
|
movie: z.ZodOptional<z.ZodBoolean>;
|
|
378
392
|
}, z.core.$strip>]>;
|
|
379
393
|
export declare const mulmoHtmlTailwindMediaSchema: z.ZodObject<{
|
|
380
394
|
type: z.ZodLiteral<"html_tailwind">;
|
|
381
|
-
html: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]
|
|
395
|
+
html: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
382
396
|
script: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
397
|
+
elements: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
383
398
|
animation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
384
399
|
fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
385
400
|
movie: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -551,8 +566,9 @@ export declare const mulmoImageAssetSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
551
566
|
}, z.core.$strip>]>>>;
|
|
552
567
|
}, z.core.$strict>, z.ZodObject<{
|
|
553
568
|
type: z.ZodLiteral<"html_tailwind">;
|
|
554
|
-
html: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]
|
|
569
|
+
html: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
555
570
|
script: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
571
|
+
elements: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
556
572
|
animation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
557
573
|
fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
558
574
|
movie: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2981,6 +2997,18 @@ export declare const mulmoImageParamsImagesValueSchema: z.ZodUnion<readonly [z.Z
|
|
|
2981
2997
|
width: z.ZodNumber;
|
|
2982
2998
|
height: z.ZodNumber;
|
|
2983
2999
|
}, z.core.$strict>>;
|
|
3000
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3001
|
+
type: z.ZodLiteral<"movie">;
|
|
3002
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3003
|
+
kind: z.ZodLiteral<"url">;
|
|
3004
|
+
url: z.ZodURL;
|
|
3005
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3006
|
+
kind: z.ZodLiteral<"base64">;
|
|
3007
|
+
data: z.ZodString;
|
|
3008
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3009
|
+
kind: z.ZodLiteral<"path">;
|
|
3010
|
+
path: z.ZodString;
|
|
3011
|
+
}, z.core.$strict>], "kind">;
|
|
2984
3012
|
}, z.core.$strict>]>;
|
|
2985
3013
|
export declare const mulmoImageParamsImagesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
2986
3014
|
type: z.ZodLiteral<"image">;
|
|
@@ -3001,6 +3029,18 @@ export declare const mulmoImageParamsImagesSchema: z.ZodRecord<z.ZodString, z.Zo
|
|
|
3001
3029
|
width: z.ZodNumber;
|
|
3002
3030
|
height: z.ZodNumber;
|
|
3003
3031
|
}, z.core.$strict>>;
|
|
3032
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3033
|
+
type: z.ZodLiteral<"movie">;
|
|
3034
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3035
|
+
kind: z.ZodLiteral<"url">;
|
|
3036
|
+
url: z.ZodURL;
|
|
3037
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3038
|
+
kind: z.ZodLiteral<"base64">;
|
|
3039
|
+
data: z.ZodString;
|
|
3040
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3041
|
+
kind: z.ZodLiteral<"path">;
|
|
3042
|
+
path: z.ZodString;
|
|
3043
|
+
}, z.core.$strict>], "kind">;
|
|
3004
3044
|
}, z.core.$strict>]>>;
|
|
3005
3045
|
export declare const mulmoFillOptionSchema: z.ZodObject<{
|
|
3006
3046
|
style: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -3073,6 +3113,18 @@ export declare const mulmoImageParamsSchema: z.ZodObject<{
|
|
|
3073
3113
|
width: z.ZodNumber;
|
|
3074
3114
|
height: z.ZodNumber;
|
|
3075
3115
|
}, z.core.$strict>>;
|
|
3116
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3117
|
+
type: z.ZodLiteral<"movie">;
|
|
3118
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3119
|
+
kind: z.ZodLiteral<"url">;
|
|
3120
|
+
url: z.ZodURL;
|
|
3121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3122
|
+
kind: z.ZodLiteral<"base64">;
|
|
3123
|
+
data: z.ZodString;
|
|
3124
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3125
|
+
kind: z.ZodLiteral<"path">;
|
|
3126
|
+
path: z.ZodString;
|
|
3127
|
+
}, z.core.$strict>], "kind">;
|
|
3076
3128
|
}, z.core.$strict>]>>>;
|
|
3077
3129
|
backgroundImage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
3078
3130
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -3621,8 +3673,9 @@ export declare const mulmoBeatSchema: z.ZodObject<{
|
|
|
3621
3673
|
}, z.core.$strip>]>>>;
|
|
3622
3674
|
}, z.core.$strict>, z.ZodObject<{
|
|
3623
3675
|
type: z.ZodLiteral<"html_tailwind">;
|
|
3624
|
-
html: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]
|
|
3676
|
+
html: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
3625
3677
|
script: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
3678
|
+
elements: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
3626
3679
|
animation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
3627
3680
|
fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
3628
3681
|
movie: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -6425,6 +6478,18 @@ export declare const mulmoPresentationStyleSchema: z.ZodObject<{
|
|
|
6425
6478
|
width: z.ZodNumber;
|
|
6426
6479
|
height: z.ZodNumber;
|
|
6427
6480
|
}, z.core.$strict>>;
|
|
6481
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6482
|
+
type: z.ZodLiteral<"movie">;
|
|
6483
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6484
|
+
kind: z.ZodLiteral<"url">;
|
|
6485
|
+
url: z.ZodURL;
|
|
6486
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6487
|
+
kind: z.ZodLiteral<"base64">;
|
|
6488
|
+
data: z.ZodString;
|
|
6489
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6490
|
+
kind: z.ZodLiteral<"path">;
|
|
6491
|
+
path: z.ZodString;
|
|
6492
|
+
}, z.core.$strict>], "kind">;
|
|
6428
6493
|
}, z.core.$strict>]>>>;
|
|
6429
6494
|
backgroundImage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
6430
6495
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -6885,6 +6950,18 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
6885
6950
|
width: z.ZodNumber;
|
|
6886
6951
|
height: z.ZodNumber;
|
|
6887
6952
|
}, z.core.$strict>>;
|
|
6953
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6954
|
+
type: z.ZodLiteral<"movie">;
|
|
6955
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6956
|
+
kind: z.ZodLiteral<"url">;
|
|
6957
|
+
url: z.ZodURL;
|
|
6958
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6959
|
+
kind: z.ZodLiteral<"base64">;
|
|
6960
|
+
data: z.ZodString;
|
|
6961
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6962
|
+
kind: z.ZodLiteral<"path">;
|
|
6963
|
+
path: z.ZodString;
|
|
6964
|
+
}, z.core.$strict>], "kind">;
|
|
6888
6965
|
}, z.core.$strict>]>>>;
|
|
6889
6966
|
backgroundImage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
6890
6967
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7428,8 +7505,9 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
7428
7505
|
}, z.core.$strip>]>>>;
|
|
7429
7506
|
}, z.core.$strict>, z.ZodObject<{
|
|
7430
7507
|
type: z.ZodLiteral<"html_tailwind">;
|
|
7431
|
-
html: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]
|
|
7508
|
+
html: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7432
7509
|
script: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7510
|
+
elements: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
7433
7511
|
animation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
7434
7512
|
fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7435
7513
|
movie: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -10307,6 +10385,18 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
10307
10385
|
width: z.ZodNumber;
|
|
10308
10386
|
height: z.ZodNumber;
|
|
10309
10387
|
}, z.core.$strict>>;
|
|
10388
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10389
|
+
type: z.ZodLiteral<"movie">;
|
|
10390
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10391
|
+
kind: z.ZodLiteral<"url">;
|
|
10392
|
+
url: z.ZodURL;
|
|
10393
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10394
|
+
kind: z.ZodLiteral<"base64">;
|
|
10395
|
+
data: z.ZodString;
|
|
10396
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10397
|
+
kind: z.ZodLiteral<"path">;
|
|
10398
|
+
path: z.ZodString;
|
|
10399
|
+
}, z.core.$strict>], "kind">;
|
|
10310
10400
|
}, z.core.$strict>]>>>;
|
|
10311
10401
|
backgroundImage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
10312
10402
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -10850,8 +10940,9 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
10850
10940
|
}, z.core.$strip>]>>>;
|
|
10851
10941
|
}, z.core.$strict>, z.ZodObject<{
|
|
10852
10942
|
type: z.ZodLiteral<"html_tailwind">;
|
|
10853
|
-
html: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]
|
|
10943
|
+
html: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
10854
10944
|
script: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
10945
|
+
elements: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
10855
10946
|
animation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
10856
10947
|
fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10857
10948
|
movie: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -13665,6 +13756,18 @@ export declare const mulmoPromptTemplateSchema: z.ZodObject<{
|
|
|
13665
13756
|
width: z.ZodNumber;
|
|
13666
13757
|
height: z.ZodNumber;
|
|
13667
13758
|
}, z.core.$strict>>;
|
|
13759
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13760
|
+
type: z.ZodLiteral<"movie">;
|
|
13761
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
13762
|
+
kind: z.ZodLiteral<"url">;
|
|
13763
|
+
url: z.ZodURL;
|
|
13764
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13765
|
+
kind: z.ZodLiteral<"base64">;
|
|
13766
|
+
data: z.ZodString;
|
|
13767
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13768
|
+
kind: z.ZodLiteral<"path">;
|
|
13769
|
+
path: z.ZodString;
|
|
13770
|
+
}, z.core.$strict>], "kind">;
|
|
13668
13771
|
}, z.core.$strict>]>>>;
|
|
13669
13772
|
backgroundImage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
13670
13773
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -14119,6 +14222,18 @@ export declare const mulmoPromptTemplateFileSchema: z.ZodObject<{
|
|
|
14119
14222
|
width: z.ZodNumber;
|
|
14120
14223
|
height: z.ZodNumber;
|
|
14121
14224
|
}, z.core.$strict>>;
|
|
14225
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
14226
|
+
type: z.ZodLiteral<"movie">;
|
|
14227
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14228
|
+
kind: z.ZodLiteral<"url">;
|
|
14229
|
+
url: z.ZodURL;
|
|
14230
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
14231
|
+
kind: z.ZodLiteral<"base64">;
|
|
14232
|
+
data: z.ZodString;
|
|
14233
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
14234
|
+
kind: z.ZodLiteral<"path">;
|
|
14235
|
+
path: z.ZodString;
|
|
14236
|
+
}, z.core.$strict>], "kind">;
|
|
14122
14237
|
}, z.core.$strict>]>>>;
|
|
14123
14238
|
backgroundImage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
14124
14239
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
package/lib/types/schema.js
CHANGED
|
@@ -142,7 +142,7 @@ const mulmoSvgMediaSchema = z
|
|
|
142
142
|
source: mediaSourceSchema,
|
|
143
143
|
})
|
|
144
144
|
.strict();
|
|
145
|
-
const mulmoMovieMediaSchema = z
|
|
145
|
+
export const mulmoMovieMediaSchema = z
|
|
146
146
|
.object({
|
|
147
147
|
type: z.literal("movie"),
|
|
148
148
|
source: mediaSourceSchema,
|
|
@@ -194,6 +194,72 @@ export const mulmoMermaidMediaSchema = z
|
|
|
194
194
|
backgroundImage: backgroundImageSchema,
|
|
195
195
|
})
|
|
196
196
|
.strict();
|
|
197
|
+
// Swipe-inspired element animation schemas
|
|
198
|
+
const swipePositionValue = z.union([z.number(), z.string()]);
|
|
199
|
+
const swipeTransitionSchema = z
|
|
200
|
+
.object({
|
|
201
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
202
|
+
rotate: z.number().optional(),
|
|
203
|
+
scale: z.union([z.number(), z.tuple([z.number(), z.number()])]).optional(),
|
|
204
|
+
translate: z.tuple([z.number(), z.number()]).optional(),
|
|
205
|
+
bc: z.string().optional(),
|
|
206
|
+
timing: z.tuple([z.number(), z.number()]).default([0, 1]).optional().describe("Animation timing [start, end] as ratio 0.0-1.0 of beat duration"),
|
|
207
|
+
})
|
|
208
|
+
.strict();
|
|
209
|
+
const swipeLoopSchema = z
|
|
210
|
+
.object({
|
|
211
|
+
style: z.enum(["vibrate", "blink", "wiggle", "spin", "shift", "bounce", "pulse"]),
|
|
212
|
+
count: z.number().optional().describe("Number of loop iterations. 0 = infinite"),
|
|
213
|
+
delta: z.number().optional().describe("Distance for vibrate / angle for wiggle"),
|
|
214
|
+
duration: z.number().optional().describe("Duration of one cycle in seconds"),
|
|
215
|
+
direction: z.enum(["n", "s", "e", "w"]).optional().describe("Direction for shift animation"),
|
|
216
|
+
clockwise: z.boolean().optional().describe("Spin direction. Default: true"),
|
|
217
|
+
})
|
|
218
|
+
.strict();
|
|
219
|
+
const swipeShadowSchema = z
|
|
220
|
+
.object({
|
|
221
|
+
color: z.string().optional().default("black"),
|
|
222
|
+
offset: z.tuple([z.number(), z.number()]).optional().default([1, 1]),
|
|
223
|
+
opacity: z.number().optional().default(0.5),
|
|
224
|
+
radius: z.number().optional().default(1),
|
|
225
|
+
})
|
|
226
|
+
.strict();
|
|
227
|
+
export const swipeElementSchema = z.lazy(() => z
|
|
228
|
+
.object({
|
|
229
|
+
id: z.string().optional(),
|
|
230
|
+
// Position & size
|
|
231
|
+
x: swipePositionValue.optional(),
|
|
232
|
+
y: swipePositionValue.optional(),
|
|
233
|
+
w: swipePositionValue.optional(),
|
|
234
|
+
h: swipePositionValue.optional(),
|
|
235
|
+
pos: z.tuple([swipePositionValue, swipePositionValue]).optional().describe("Position by anchor point [x, y]"),
|
|
236
|
+
// Visual
|
|
237
|
+
bc: z.string().optional().describe("Background color"),
|
|
238
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
239
|
+
rotate: z.number().optional(),
|
|
240
|
+
scale: z.union([z.number(), z.tuple([z.number(), z.number()])]).optional(),
|
|
241
|
+
translate: z.tuple([z.number(), z.number()]).optional(),
|
|
242
|
+
cornerRadius: z.number().optional(),
|
|
243
|
+
borderWidth: z.number().optional(),
|
|
244
|
+
borderColor: z.string().optional(),
|
|
245
|
+
shadow: swipeShadowSchema.optional(),
|
|
246
|
+
clip: z.boolean().optional(),
|
|
247
|
+
// Content
|
|
248
|
+
text: z.string().optional(),
|
|
249
|
+
fontSize: z.union([z.number(), z.string()]).optional(),
|
|
250
|
+
fontWeight: z.string().optional(),
|
|
251
|
+
textColor: z.string().optional(),
|
|
252
|
+
textAlign: z.enum(["center", "left", "right"]).optional(),
|
|
253
|
+
lineHeight: z.union([z.number(), z.string()]).optional(),
|
|
254
|
+
img: z.string().optional().describe("Image URL or image:ref"),
|
|
255
|
+
imgFit: z.enum(["contain", "cover", "fill"]).optional().default("contain"),
|
|
256
|
+
// Animation
|
|
257
|
+
to: swipeTransitionSchema.optional().describe("Transition animation"),
|
|
258
|
+
loop: swipeLoopSchema.optional().describe("Loop animation"),
|
|
259
|
+
// Children
|
|
260
|
+
elements: z.array(z.lazy(() => swipeElementSchema)).optional(),
|
|
261
|
+
})
|
|
262
|
+
.strict());
|
|
197
263
|
export const htmlTailwindAnimationSchema = z.union([
|
|
198
264
|
z.literal(true),
|
|
199
265
|
z.object({
|
|
@@ -204,8 +270,12 @@ export const htmlTailwindAnimationSchema = z.union([
|
|
|
204
270
|
export const mulmoHtmlTailwindMediaSchema = z
|
|
205
271
|
.object({
|
|
206
272
|
type: z.literal("html_tailwind"),
|
|
207
|
-
html: stringOrStringArray,
|
|
273
|
+
html: stringOrStringArray.optional(),
|
|
208
274
|
script: stringOrStringArray.optional().describe("JavaScript code for the beat. Injected as a <script> tag after html. Use for render() function etc."),
|
|
275
|
+
elements: z
|
|
276
|
+
.array(swipeElementSchema)
|
|
277
|
+
.optional()
|
|
278
|
+
.describe("Swipe-style declarative animation elements. Converted to HTML + render() automatically. Use this OR html, not both."),
|
|
209
279
|
animation: htmlTailwindAnimationSchema
|
|
210
280
|
.optional()
|
|
211
281
|
.describe("Enable frame-based animation (Remotion-style). true for defaults (30fps), or { fps: N } for custom frame rate."),
|
|
@@ -267,7 +337,7 @@ export const mulmoImagePromptMediaSchema = z
|
|
|
267
337
|
canvasSize: z.object({ width: z.number(), height: z.number() }).strict().optional(),
|
|
268
338
|
})
|
|
269
339
|
.strict();
|
|
270
|
-
export const mulmoImageParamsImagesValueSchema = z.union([mulmoImageMediaSchema, mulmoImagePromptMediaSchema]);
|
|
340
|
+
export const mulmoImageParamsImagesValueSchema = z.union([mulmoImageMediaSchema, mulmoImagePromptMediaSchema, mulmoMovieMediaSchema]);
|
|
271
341
|
export const mulmoImageParamsImagesSchema = z.record(imageIdSchema, mulmoImageParamsImagesValueSchema);
|
|
272
342
|
export const mulmoFillOptionSchema = z
|
|
273
343
|
.object({
|
package/lib/types/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CallbackFunction } from "graphai";
|
|
2
|
-
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualArraySchema, mulmoStudioMultiLingualDataSchema, mulmoStudioMultiLingualFileSchema, speakerDictionarySchema, speakerSchema, mulmoSpeechParamsSchema, mulmoImageParamsSchema, mulmoImageParamsImagesValueSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoTransitionSchema, mulmoVideoFilterSchema, mulmoMovieParamsSchema, mulmoSoundEffectParamsSchema, mulmoLipSyncParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoPromptTemplateSchema, mulmoPromptTemplateFileSchema, text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoImageAssetSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mediaSourceMermaidSchema, backgroundImageSchema, backgroundImageSourceSchema, mulmoSessionStateSchema, mulmoOpenAIImageModelSchema, mulmoGoogleImageModelSchema, mulmoGoogleMovieModelSchema, mulmoReplicateMovieModelSchema, mulmoImagePromptMediaSchema, markdownLayoutSchema, row2Schema, grid2x2Schema } from "./schema.js";
|
|
2
|
+
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualArraySchema, mulmoStudioMultiLingualDataSchema, mulmoStudioMultiLingualFileSchema, speakerDictionarySchema, speakerSchema, mulmoSpeechParamsSchema, mulmoImageParamsSchema, mulmoImageParamsImagesValueSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoTransitionSchema, mulmoVideoFilterSchema, mulmoMovieParamsSchema, mulmoSoundEffectParamsSchema, mulmoLipSyncParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoPromptTemplateSchema, mulmoPromptTemplateFileSchema, text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoImageAssetSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mediaSourceMermaidSchema, backgroundImageSchema, backgroundImageSourceSchema, mulmoSessionStateSchema, mulmoOpenAIImageModelSchema, mulmoGoogleImageModelSchema, mulmoGoogleMovieModelSchema, mulmoReplicateMovieModelSchema, mulmoImagePromptMediaSchema, mulmoMovieMediaSchema, markdownLayoutSchema, row2Schema, grid2x2Schema } from "./schema.js";
|
|
3
3
|
import { pdf_modes, pdf_sizes, storyToScriptGenerateMode } from "./const.js";
|
|
4
4
|
import type { LLM } from "./provider2agent.js";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -55,6 +55,7 @@ export type MulmoImageAsset = z.infer<typeof mulmoImageAssetSchema>;
|
|
|
55
55
|
export type MulmoTextSlideMedia = z.infer<typeof mulmoTextSlideMediaSchema>;
|
|
56
56
|
export type MulmoMarkdownMedia = z.infer<typeof mulmoMarkdownMediaSchema>;
|
|
57
57
|
export type MulmoImageMedia = z.infer<typeof mulmoImageMediaSchema>;
|
|
58
|
+
export type MulmoMovieMedia = z.infer<typeof mulmoMovieMediaSchema>;
|
|
58
59
|
export type MulmoChartMedia = z.infer<typeof mulmoChartMediaSchema>;
|
|
59
60
|
export type MulmoMermaidMedia = z.infer<typeof mulmoMermaidMediaSchema>;
|
|
60
61
|
export type MulmoSessionState = z.infer<typeof mulmoSessionStateSchema>;
|
|
@@ -84,6 +85,7 @@ export type ImageProcessorParams = {
|
|
|
84
85
|
textSlideStyle: string;
|
|
85
86
|
canvasSize: MulmoCanvasDimension;
|
|
86
87
|
imageRefs?: Record<string, string>;
|
|
88
|
+
movieRefs?: Record<string, string>;
|
|
87
89
|
beatDuration?: number;
|
|
88
90
|
};
|
|
89
91
|
export type PDFMode = (typeof pdf_modes)[number];
|