mulmocast 2.6.3 → 2.6.4
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/README.md +2 -1
- package/assets/html/chart.html +40 -7
- package/lib/actions/image_agents.d.ts +6 -0
- package/lib/actions/image_agents.js +28 -2
- package/lib/actions/images.d.ts +26 -0
- package/lib/actions/images.js +2 -0
- package/lib/agents/movie_genai_agent.js +36 -6
- package/lib/agents/movie_replicate_agent.js +20 -3
- package/lib/methods/mulmo_presentation_style.d.ts +6 -0
- package/lib/slide/layouts/index.js +3 -0
- package/lib/slide/layouts/waterfall.d.ts +2 -0
- package/lib/slide/layouts/waterfall.js +63 -0
- package/lib/slide/render.js +4 -1
- package/lib/slide/schema.d.ts +176 -0
- package/lib/slide/schema.js +18 -0
- package/lib/slide/utils.d.ts +1 -0
- package/lib/slide/utils.js +21 -1
- package/lib/types/agent.d.ts +6 -0
- package/lib/types/provider2agent.d.ts +6 -11
- package/lib/types/provider2agent.js +10 -0
- package/lib/types/schema.d.ts +400 -0
- package/lib/types/schema.js +12 -0
- package/lib/types/slide.d.ts +176 -0
- package/lib/types/slide.js +18 -0
- package/lib/utils/context.d.ts +112 -0
- package/lib/utils/html_render.js +4 -3
- package/lib/utils/image_plugins/chart.js +19 -6
- package/lib/utils/image_plugins/mermaid.js +5 -1
- package/package.json +1 -1
- package/scripts/test/test_ir_visualizations.json +317 -0
- package/scripts/test/test_movie_references.json +101 -0
- package/scripts/test/test_plugin_features.json +151 -0
package/lib/types/slide.d.ts
CHANGED
|
@@ -4284,6 +4284,74 @@ export declare const tableSlideSchema: z.ZodObject<{
|
|
|
4284
4284
|
}, z.core.$strip>>;
|
|
4285
4285
|
layout: z.ZodLiteral<"table">;
|
|
4286
4286
|
}, z.core.$strip>;
|
|
4287
|
+
export declare const waterfallItemSchema: z.ZodObject<{
|
|
4288
|
+
label: z.ZodString;
|
|
4289
|
+
value: z.ZodNumber;
|
|
4290
|
+
isTotal: z.ZodOptional<z.ZodBoolean>;
|
|
4291
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
4292
|
+
success: "success";
|
|
4293
|
+
primary: "primary";
|
|
4294
|
+
accent: "accent";
|
|
4295
|
+
warning: "warning";
|
|
4296
|
+
danger: "danger";
|
|
4297
|
+
info: "info";
|
|
4298
|
+
highlight: "highlight";
|
|
4299
|
+
}>>;
|
|
4300
|
+
}, z.core.$strip>;
|
|
4301
|
+
export declare const waterfallSlideSchema: z.ZodObject<{
|
|
4302
|
+
title: z.ZodString;
|
|
4303
|
+
stepLabel: z.ZodOptional<z.ZodString>;
|
|
4304
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
4305
|
+
items: z.ZodArray<z.ZodObject<{
|
|
4306
|
+
label: z.ZodString;
|
|
4307
|
+
value: z.ZodNumber;
|
|
4308
|
+
isTotal: z.ZodOptional<z.ZodBoolean>;
|
|
4309
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
4310
|
+
success: "success";
|
|
4311
|
+
primary: "primary";
|
|
4312
|
+
accent: "accent";
|
|
4313
|
+
warning: "warning";
|
|
4314
|
+
danger: "danger";
|
|
4315
|
+
info: "info";
|
|
4316
|
+
highlight: "highlight";
|
|
4317
|
+
}>>;
|
|
4318
|
+
}, z.core.$strip>>;
|
|
4319
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
4320
|
+
callout: z.ZodOptional<z.ZodObject<{
|
|
4321
|
+
text: z.ZodString;
|
|
4322
|
+
label: z.ZodOptional<z.ZodString>;
|
|
4323
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
4324
|
+
success: "success";
|
|
4325
|
+
primary: "primary";
|
|
4326
|
+
accent: "accent";
|
|
4327
|
+
warning: "warning";
|
|
4328
|
+
danger: "danger";
|
|
4329
|
+
info: "info";
|
|
4330
|
+
highlight: "highlight";
|
|
4331
|
+
}>>;
|
|
4332
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
4333
|
+
left: "left";
|
|
4334
|
+
center: "center";
|
|
4335
|
+
}>>;
|
|
4336
|
+
leftBar: z.ZodOptional<z.ZodBoolean>;
|
|
4337
|
+
}, z.core.$strip>>;
|
|
4338
|
+
accentColor: z.ZodOptional<z.ZodEnum<{
|
|
4339
|
+
success: "success";
|
|
4340
|
+
primary: "primary";
|
|
4341
|
+
accent: "accent";
|
|
4342
|
+
warning: "warning";
|
|
4343
|
+
danger: "danger";
|
|
4344
|
+
info: "info";
|
|
4345
|
+
highlight: "highlight";
|
|
4346
|
+
}>>;
|
|
4347
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
4348
|
+
bgColor: z.ZodOptional<z.ZodString>;
|
|
4349
|
+
decorations: z.ZodOptional<z.ZodBoolean>;
|
|
4350
|
+
bgOpacity: z.ZodOptional<z.ZodNumber>;
|
|
4351
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
4352
|
+
}, z.core.$strip>>;
|
|
4353
|
+
layout: z.ZodLiteral<"waterfall">;
|
|
4354
|
+
}, z.core.$strip>;
|
|
4287
4355
|
export declare const funnelStageSchema: z.ZodObject<{
|
|
4288
4356
|
label: z.ZodString;
|
|
4289
4357
|
value: z.ZodOptional<z.ZodString>;
|
|
@@ -6714,6 +6782,59 @@ export declare const slideLayoutSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
6714
6782
|
footer: z.ZodOptional<z.ZodString>;
|
|
6715
6783
|
}, z.core.$strip>>;
|
|
6716
6784
|
layout: z.ZodLiteral<"funnel">;
|
|
6785
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6786
|
+
title: z.ZodString;
|
|
6787
|
+
stepLabel: z.ZodOptional<z.ZodString>;
|
|
6788
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
6789
|
+
items: z.ZodArray<z.ZodObject<{
|
|
6790
|
+
label: z.ZodString;
|
|
6791
|
+
value: z.ZodNumber;
|
|
6792
|
+
isTotal: z.ZodOptional<z.ZodBoolean>;
|
|
6793
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
6794
|
+
success: "success";
|
|
6795
|
+
primary: "primary";
|
|
6796
|
+
accent: "accent";
|
|
6797
|
+
warning: "warning";
|
|
6798
|
+
danger: "danger";
|
|
6799
|
+
info: "info";
|
|
6800
|
+
highlight: "highlight";
|
|
6801
|
+
}>>;
|
|
6802
|
+
}, z.core.$strip>>;
|
|
6803
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
6804
|
+
callout: z.ZodOptional<z.ZodObject<{
|
|
6805
|
+
text: z.ZodString;
|
|
6806
|
+
label: z.ZodOptional<z.ZodString>;
|
|
6807
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
6808
|
+
success: "success";
|
|
6809
|
+
primary: "primary";
|
|
6810
|
+
accent: "accent";
|
|
6811
|
+
warning: "warning";
|
|
6812
|
+
danger: "danger";
|
|
6813
|
+
info: "info";
|
|
6814
|
+
highlight: "highlight";
|
|
6815
|
+
}>>;
|
|
6816
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
6817
|
+
left: "left";
|
|
6818
|
+
center: "center";
|
|
6819
|
+
}>>;
|
|
6820
|
+
leftBar: z.ZodOptional<z.ZodBoolean>;
|
|
6821
|
+
}, z.core.$strip>>;
|
|
6822
|
+
accentColor: z.ZodOptional<z.ZodEnum<{
|
|
6823
|
+
success: "success";
|
|
6824
|
+
primary: "primary";
|
|
6825
|
+
accent: "accent";
|
|
6826
|
+
warning: "warning";
|
|
6827
|
+
danger: "danger";
|
|
6828
|
+
info: "info";
|
|
6829
|
+
highlight: "highlight";
|
|
6830
|
+
}>>;
|
|
6831
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
6832
|
+
bgColor: z.ZodOptional<z.ZodString>;
|
|
6833
|
+
decorations: z.ZodOptional<z.ZodBoolean>;
|
|
6834
|
+
bgOpacity: z.ZodOptional<z.ZodNumber>;
|
|
6835
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
6836
|
+
}, z.core.$strip>>;
|
|
6837
|
+
layout: z.ZodLiteral<"waterfall">;
|
|
6717
6838
|
}, z.core.$strip>], "layout">;
|
|
6718
6839
|
/** Media schema registered in mulmoImageAssetSchema */
|
|
6719
6840
|
export declare const mulmoSlideMediaSchema: z.ZodObject<{
|
|
@@ -9043,6 +9164,59 @@ export declare const mulmoSlideMediaSchema: z.ZodObject<{
|
|
|
9043
9164
|
footer: z.ZodOptional<z.ZodString>;
|
|
9044
9165
|
}, z.core.$strip>>;
|
|
9045
9166
|
layout: z.ZodLiteral<"funnel">;
|
|
9167
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9168
|
+
title: z.ZodString;
|
|
9169
|
+
stepLabel: z.ZodOptional<z.ZodString>;
|
|
9170
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
9171
|
+
items: z.ZodArray<z.ZodObject<{
|
|
9172
|
+
label: z.ZodString;
|
|
9173
|
+
value: z.ZodNumber;
|
|
9174
|
+
isTotal: z.ZodOptional<z.ZodBoolean>;
|
|
9175
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
9176
|
+
success: "success";
|
|
9177
|
+
primary: "primary";
|
|
9178
|
+
accent: "accent";
|
|
9179
|
+
warning: "warning";
|
|
9180
|
+
danger: "danger";
|
|
9181
|
+
info: "info";
|
|
9182
|
+
highlight: "highlight";
|
|
9183
|
+
}>>;
|
|
9184
|
+
}, z.core.$strip>>;
|
|
9185
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
9186
|
+
callout: z.ZodOptional<z.ZodObject<{
|
|
9187
|
+
text: z.ZodString;
|
|
9188
|
+
label: z.ZodOptional<z.ZodString>;
|
|
9189
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
9190
|
+
success: "success";
|
|
9191
|
+
primary: "primary";
|
|
9192
|
+
accent: "accent";
|
|
9193
|
+
warning: "warning";
|
|
9194
|
+
danger: "danger";
|
|
9195
|
+
info: "info";
|
|
9196
|
+
highlight: "highlight";
|
|
9197
|
+
}>>;
|
|
9198
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
9199
|
+
left: "left";
|
|
9200
|
+
center: "center";
|
|
9201
|
+
}>>;
|
|
9202
|
+
leftBar: z.ZodOptional<z.ZodBoolean>;
|
|
9203
|
+
}, z.core.$strip>>;
|
|
9204
|
+
accentColor: z.ZodOptional<z.ZodEnum<{
|
|
9205
|
+
success: "success";
|
|
9206
|
+
primary: "primary";
|
|
9207
|
+
accent: "accent";
|
|
9208
|
+
warning: "warning";
|
|
9209
|
+
danger: "danger";
|
|
9210
|
+
info: "info";
|
|
9211
|
+
highlight: "highlight";
|
|
9212
|
+
}>>;
|
|
9213
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
9214
|
+
bgColor: z.ZodOptional<z.ZodString>;
|
|
9215
|
+
decorations: z.ZodOptional<z.ZodBoolean>;
|
|
9216
|
+
bgOpacity: z.ZodOptional<z.ZodNumber>;
|
|
9217
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
9218
|
+
}, z.core.$strip>>;
|
|
9219
|
+
layout: z.ZodLiteral<"waterfall">;
|
|
9046
9220
|
}, z.core.$strip>], "layout">;
|
|
9047
9221
|
reference: z.ZodOptional<z.ZodString>;
|
|
9048
9222
|
branding: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -9128,6 +9302,8 @@ export type TableCellValue = z.infer<typeof tableCellValueSchema>;
|
|
|
9128
9302
|
export type TableSlide = z.infer<typeof tableSlideSchema>;
|
|
9129
9303
|
export type FunnelStage = z.infer<typeof funnelStageSchema>;
|
|
9130
9304
|
export type FunnelSlide = z.infer<typeof funnelSlideSchema>;
|
|
9305
|
+
export type WaterfallItem = z.infer<typeof waterfallItemSchema>;
|
|
9306
|
+
export type WaterfallSlide = z.infer<typeof waterfallSlideSchema>;
|
|
9131
9307
|
export type SlideBrandingLogo = z.infer<typeof slideBrandingLogoSchema>;
|
|
9132
9308
|
export type SlideBranding = z.infer<typeof slideBrandingSchema>;
|
|
9133
9309
|
export type MulmoSlideMedia = z.infer<typeof mulmoSlideMediaSchema>;
|
package/lib/types/slide.js
CHANGED
|
@@ -341,6 +341,23 @@ export const tableSlideSchema = z.object({
|
|
|
341
341
|
striped: z.boolean().optional(),
|
|
342
342
|
callout: calloutBarSchema.optional(),
|
|
343
343
|
});
|
|
344
|
+
// ─── waterfall ───
|
|
345
|
+
export const waterfallItemSchema = z.object({
|
|
346
|
+
label: z.string(),
|
|
347
|
+
value: z.number(),
|
|
348
|
+
isTotal: z.boolean().optional(),
|
|
349
|
+
color: accentColorKeySchema.optional(),
|
|
350
|
+
});
|
|
351
|
+
export const waterfallSlideSchema = z.object({
|
|
352
|
+
layout: z.literal("waterfall"),
|
|
353
|
+
...slideBaseFields,
|
|
354
|
+
title: z.string(),
|
|
355
|
+
stepLabel: z.string().optional(),
|
|
356
|
+
subtitle: z.string().optional(),
|
|
357
|
+
items: z.array(waterfallItemSchema),
|
|
358
|
+
unit: z.string().optional(),
|
|
359
|
+
callout: calloutBarSchema.optional(),
|
|
360
|
+
});
|
|
344
361
|
// ─── funnel ───
|
|
345
362
|
export const funnelStageSchema = z.object({
|
|
346
363
|
label: z.string(),
|
|
@@ -403,6 +420,7 @@ export const slideLayoutSchema = z.discriminatedUnion("layout", [
|
|
|
403
420
|
matrixSlideSchema,
|
|
404
421
|
tableSlideSchema,
|
|
405
422
|
funnelSlideSchema,
|
|
423
|
+
waterfallSlideSchema,
|
|
406
424
|
]);
|
|
407
425
|
/** Media schema registered in mulmoImageAssetSchema */
|
|
408
426
|
export const mulmoSlideMediaSchema = z
|
package/lib/utils/context.d.ts
CHANGED
|
@@ -263,6 +263,12 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
|
|
|
263
263
|
})[] | undefined;
|
|
264
264
|
vertexai_project?: string | undefined;
|
|
265
265
|
vertexai_location?: string | undefined;
|
|
266
|
+
firstFrameImageName?: string | undefined;
|
|
267
|
+
lastFrameImageName?: string | undefined;
|
|
268
|
+
referenceImages?: {
|
|
269
|
+
imageName: string;
|
|
270
|
+
referenceType: "ASSET" | "STYLE";
|
|
271
|
+
}[] | undefined;
|
|
266
272
|
};
|
|
267
273
|
soundEffectParams: {
|
|
268
274
|
provider?: string | undefined;
|
|
@@ -1548,6 +1554,32 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
|
|
|
1548
1554
|
bgOpacity?: number | undefined;
|
|
1549
1555
|
footer?: string | undefined;
|
|
1550
1556
|
} | undefined;
|
|
1557
|
+
} | {
|
|
1558
|
+
title: string;
|
|
1559
|
+
items: {
|
|
1560
|
+
label: string;
|
|
1561
|
+
value: number;
|
|
1562
|
+
isTotal?: boolean | undefined;
|
|
1563
|
+
color?: "success" | "primary" | "accent" | "warning" | "danger" | "info" | "highlight" | undefined;
|
|
1564
|
+
}[];
|
|
1565
|
+
layout: "waterfall";
|
|
1566
|
+
stepLabel?: string | undefined;
|
|
1567
|
+
subtitle?: string | undefined;
|
|
1568
|
+
unit?: string | undefined;
|
|
1569
|
+
callout?: {
|
|
1570
|
+
text: string;
|
|
1571
|
+
label?: string | undefined;
|
|
1572
|
+
color?: "success" | "primary" | "accent" | "warning" | "danger" | "info" | "highlight" | undefined;
|
|
1573
|
+
align?: "left" | "center" | undefined;
|
|
1574
|
+
leftBar?: boolean | undefined;
|
|
1575
|
+
} | undefined;
|
|
1576
|
+
accentColor?: "success" | "primary" | "accent" | "warning" | "danger" | "info" | "highlight" | undefined;
|
|
1577
|
+
style?: {
|
|
1578
|
+
bgColor?: string | undefined;
|
|
1579
|
+
decorations?: boolean | undefined;
|
|
1580
|
+
bgOpacity?: number | undefined;
|
|
1581
|
+
footer?: string | undefined;
|
|
1582
|
+
} | undefined;
|
|
1551
1583
|
};
|
|
1552
1584
|
theme?: {
|
|
1553
1585
|
colors: {
|
|
@@ -1707,6 +1739,21 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
|
|
|
1707
1739
|
type: "chart";
|
|
1708
1740
|
title: string;
|
|
1709
1741
|
chartData: Record<string, any>;
|
|
1742
|
+
style?: string | undefined;
|
|
1743
|
+
backgroundImage?: string | {
|
|
1744
|
+
source: {
|
|
1745
|
+
kind: "url";
|
|
1746
|
+
url: string;
|
|
1747
|
+
} | {
|
|
1748
|
+
kind: "base64";
|
|
1749
|
+
data: string;
|
|
1750
|
+
} | {
|
|
1751
|
+
kind: "path";
|
|
1752
|
+
path: string;
|
|
1753
|
+
};
|
|
1754
|
+
size?: "contain" | "cover" | "fill" | "auto" | undefined;
|
|
1755
|
+
opacity?: number | undefined;
|
|
1756
|
+
} | null | undefined;
|
|
1710
1757
|
} | {
|
|
1711
1758
|
type: "mermaid";
|
|
1712
1759
|
title: string;
|
|
@@ -1949,6 +1996,12 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
|
|
|
1949
1996
|
})[] | undefined;
|
|
1950
1997
|
vertexai_project?: string | undefined;
|
|
1951
1998
|
vertexai_location?: string | undefined;
|
|
1999
|
+
firstFrameImageName?: string | undefined;
|
|
2000
|
+
lastFrameImageName?: string | undefined;
|
|
2001
|
+
referenceImages?: {
|
|
2002
|
+
imageName: string;
|
|
2003
|
+
referenceType: "ASSET" | "STYLE";
|
|
2004
|
+
}[] | undefined;
|
|
1952
2005
|
speed?: number | undefined;
|
|
1953
2006
|
} | undefined;
|
|
1954
2007
|
soundEffectParams?: {
|
|
@@ -2415,6 +2468,12 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
2415
2468
|
})[] | undefined;
|
|
2416
2469
|
vertexai_project?: string | undefined;
|
|
2417
2470
|
vertexai_location?: string | undefined;
|
|
2471
|
+
firstFrameImageName?: string | undefined;
|
|
2472
|
+
lastFrameImageName?: string | undefined;
|
|
2473
|
+
referenceImages?: {
|
|
2474
|
+
imageName: string;
|
|
2475
|
+
referenceType: "ASSET" | "STYLE";
|
|
2476
|
+
}[] | undefined;
|
|
2418
2477
|
};
|
|
2419
2478
|
soundEffectParams: {
|
|
2420
2479
|
provider?: string | undefined;
|
|
@@ -3700,6 +3759,32 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
3700
3759
|
bgOpacity?: number | undefined;
|
|
3701
3760
|
footer?: string | undefined;
|
|
3702
3761
|
} | undefined;
|
|
3762
|
+
} | {
|
|
3763
|
+
title: string;
|
|
3764
|
+
items: {
|
|
3765
|
+
label: string;
|
|
3766
|
+
value: number;
|
|
3767
|
+
isTotal?: boolean | undefined;
|
|
3768
|
+
color?: "success" | "primary" | "accent" | "warning" | "danger" | "info" | "highlight" | undefined;
|
|
3769
|
+
}[];
|
|
3770
|
+
layout: "waterfall";
|
|
3771
|
+
stepLabel?: string | undefined;
|
|
3772
|
+
subtitle?: string | undefined;
|
|
3773
|
+
unit?: string | undefined;
|
|
3774
|
+
callout?: {
|
|
3775
|
+
text: string;
|
|
3776
|
+
label?: string | undefined;
|
|
3777
|
+
color?: "success" | "primary" | "accent" | "warning" | "danger" | "info" | "highlight" | undefined;
|
|
3778
|
+
align?: "left" | "center" | undefined;
|
|
3779
|
+
leftBar?: boolean | undefined;
|
|
3780
|
+
} | undefined;
|
|
3781
|
+
accentColor?: "success" | "primary" | "accent" | "warning" | "danger" | "info" | "highlight" | undefined;
|
|
3782
|
+
style?: {
|
|
3783
|
+
bgColor?: string | undefined;
|
|
3784
|
+
decorations?: boolean | undefined;
|
|
3785
|
+
bgOpacity?: number | undefined;
|
|
3786
|
+
footer?: string | undefined;
|
|
3787
|
+
} | undefined;
|
|
3703
3788
|
};
|
|
3704
3789
|
theme?: {
|
|
3705
3790
|
colors: {
|
|
@@ -3859,6 +3944,21 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
3859
3944
|
type: "chart";
|
|
3860
3945
|
title: string;
|
|
3861
3946
|
chartData: Record<string, any>;
|
|
3947
|
+
style?: string | undefined;
|
|
3948
|
+
backgroundImage?: string | {
|
|
3949
|
+
source: {
|
|
3950
|
+
kind: "url";
|
|
3951
|
+
url: string;
|
|
3952
|
+
} | {
|
|
3953
|
+
kind: "base64";
|
|
3954
|
+
data: string;
|
|
3955
|
+
} | {
|
|
3956
|
+
kind: "path";
|
|
3957
|
+
path: string;
|
|
3958
|
+
};
|
|
3959
|
+
size?: "contain" | "cover" | "fill" | "auto" | undefined;
|
|
3960
|
+
opacity?: number | undefined;
|
|
3961
|
+
} | null | undefined;
|
|
3862
3962
|
} | {
|
|
3863
3963
|
type: "mermaid";
|
|
3864
3964
|
title: string;
|
|
@@ -4101,6 +4201,12 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
4101
4201
|
})[] | undefined;
|
|
4102
4202
|
vertexai_project?: string | undefined;
|
|
4103
4203
|
vertexai_location?: string | undefined;
|
|
4204
|
+
firstFrameImageName?: string | undefined;
|
|
4205
|
+
lastFrameImageName?: string | undefined;
|
|
4206
|
+
referenceImages?: {
|
|
4207
|
+
imageName: string;
|
|
4208
|
+
referenceType: "ASSET" | "STYLE";
|
|
4209
|
+
}[] | undefined;
|
|
4104
4210
|
speed?: number | undefined;
|
|
4105
4211
|
} | undefined;
|
|
4106
4212
|
soundEffectParams?: {
|
|
@@ -4574,6 +4680,12 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
4574
4680
|
})[] | undefined;
|
|
4575
4681
|
vertexai_project?: string | undefined;
|
|
4576
4682
|
vertexai_location?: string | undefined;
|
|
4683
|
+
firstFrameImageName?: string | undefined;
|
|
4684
|
+
lastFrameImageName?: string | undefined;
|
|
4685
|
+
referenceImages?: {
|
|
4686
|
+
imageName: string;
|
|
4687
|
+
referenceType: "ASSET" | "STYLE";
|
|
4688
|
+
}[] | undefined;
|
|
4577
4689
|
};
|
|
4578
4690
|
soundEffectParams: {
|
|
4579
4691
|
provider?: string | undefined;
|
package/lib/utils/html_render.js
CHANGED
|
@@ -69,9 +69,9 @@ const scaleContentToFit = async (page, viewportWidth, viewportHeight) => {
|
|
|
69
69
|
};
|
|
70
70
|
/** Determine the appropriate waitUntil strategy based on HTML content */
|
|
71
71
|
const resolveWaitUntil = (html) => {
|
|
72
|
-
const
|
|
72
|
+
const hasExternalResources = (html.includes("<img") && /src=["']https?:\/\//.test(html)) || /script src=["']https?:\/\//.test(html);
|
|
73
73
|
const hasLocalImages = html.includes("<img") && /src=["']file:\/\//.test(html);
|
|
74
|
-
if (
|
|
74
|
+
if (hasExternalResources)
|
|
75
75
|
return "networkidle0";
|
|
76
76
|
if (hasLocalImages)
|
|
77
77
|
return "load";
|
|
@@ -86,7 +86,8 @@ const resolveWaitUntil = (html) => {
|
|
|
86
86
|
const loadHtmlIntoPage = async (page, html, timeout_ms) => {
|
|
87
87
|
const waitUntil = resolveWaitUntil(html);
|
|
88
88
|
const hasFileUrls = /file:\/\//.test(html);
|
|
89
|
-
|
|
89
|
+
const hasExternalScripts = /script src=["']https?:\/\//.test(html);
|
|
90
|
+
if (hasFileUrls || hasExternalScripts) {
|
|
90
91
|
const tmpFile = nodePath.join(os.tmpdir(), `mulmocast_render_${crypto.randomUUID()}.html`);
|
|
91
92
|
fs.writeFileSync(tmpFile, html);
|
|
92
93
|
try {
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import { getHTMLFile } from "../file.js";
|
|
2
2
|
import { renderHTMLToImage, interpolate } from "../html_render.js";
|
|
3
3
|
import { parrotingImagePath, generateUniqueId } from "./utils.js";
|
|
4
|
+
import { resolveCombinedStyle } from "./bg_image_util.js";
|
|
4
5
|
export const imageType = "chart";
|
|
6
|
+
/** Chart.js plugin CDN URLs keyed by chart type */
|
|
7
|
+
const CHART_PLUGIN_CDNS = {
|
|
8
|
+
sankey: "https://cdn.jsdelivr.net/npm/chartjs-chart-sankey",
|
|
9
|
+
treemap: "https://cdn.jsdelivr.net/npm/chartjs-chart-treemap@3",
|
|
10
|
+
};
|
|
11
|
+
/** Resolve CDN script tags for Chart.js plugins based on chart type */
|
|
12
|
+
const resolveChartPlugins = (chartType) => {
|
|
13
|
+
const cdn = CHART_PLUGIN_CDNS[chartType];
|
|
14
|
+
if (!cdn)
|
|
15
|
+
return "";
|
|
16
|
+
return `<script src="${cdn}"></script>`;
|
|
17
|
+
};
|
|
5
18
|
const processChart = async (params) => {
|
|
6
|
-
const { beat, imagePath, canvasSize
|
|
19
|
+
const { beat, imagePath, canvasSize } = params;
|
|
7
20
|
if (!beat.image || beat.image.type !== imageType)
|
|
8
21
|
return;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
beat.image.chartData.type === "polarArea" ||
|
|
12
|
-
beat.image.chartData.type === "radar";
|
|
22
|
+
const chartType = beat.image.chartData.type;
|
|
23
|
+
const isCircular = chartType === "pie" || chartType === "doughnut" || chartType === "polarArea" || chartType === "radar";
|
|
13
24
|
const chart_width = isCircular ? Math.min(canvasSize.width, canvasSize.height) * 0.75 : canvasSize.width * 0.75;
|
|
25
|
+
const combinedStyle = await resolveCombinedStyle(params, beat.image.backgroundImage, beat.image.style);
|
|
14
26
|
const template = getHTMLFile("chart");
|
|
15
27
|
const htmlData = interpolate(template, {
|
|
16
28
|
title: beat.image.title,
|
|
17
|
-
style:
|
|
29
|
+
style: combinedStyle,
|
|
18
30
|
chart_width: chart_width.toString(),
|
|
19
31
|
chart_data: JSON.stringify(beat.image.chartData),
|
|
32
|
+
chart_plugins: resolveChartPlugins(chartType),
|
|
20
33
|
});
|
|
21
34
|
await renderHTMLToImage(htmlData, imagePath, canvasSize.width, canvasSize.height);
|
|
22
35
|
return imagePath;
|
|
@@ -3,6 +3,7 @@ import { getHTMLFile } from "../file.js";
|
|
|
3
3
|
import { renderHTMLToImage, interpolate } from "../html_render.js";
|
|
4
4
|
import { parrotingImagePath, generateUniqueId } from "./utils.js";
|
|
5
5
|
import { resolveCombinedStyle } from "./bg_image_util.js";
|
|
6
|
+
import { resolveImageRefs, resolveMovieRefs, resolveRelativeImagePaths } from "./html_tailwind.js";
|
|
6
7
|
export const imageType = "mermaid";
|
|
7
8
|
// Generate mermaid HTML from code string (shared utility)
|
|
8
9
|
export const generateMermaidHtml = (code, title) => {
|
|
@@ -26,11 +27,14 @@ const processMermaid = async (params) => {
|
|
|
26
27
|
const diagram_code = await MulmoMediaSourceMethods.getText(beat.image.code, context);
|
|
27
28
|
if (diagram_code) {
|
|
28
29
|
const combinedStyle = await resolveCombinedStyle(params, beat.image.backgroundImage, beat.image.style);
|
|
29
|
-
const
|
|
30
|
+
const rawHtml = interpolate(template, {
|
|
30
31
|
title: beat.image.title,
|
|
31
32
|
style: combinedStyle,
|
|
32
33
|
diagram_code: `${diagram_code}\n${beat.image.appendix?.join("\n") ?? ""}`,
|
|
33
34
|
});
|
|
35
|
+
const resolvedImageRefs = resolveImageRefs(rawHtml, params.imageRefs ?? {});
|
|
36
|
+
const resolvedAllRefs = resolveMovieRefs(resolvedImageRefs, params.movieRefs ?? {});
|
|
37
|
+
const htmlData = resolveRelativeImagePaths(resolvedAllRefs, context.fileDirs.mulmoFileDirPath);
|
|
34
38
|
await renderHTMLToImage(htmlData, imagePath, canvasSize.width, canvasSize.height, true);
|
|
35
39
|
}
|
|
36
40
|
return imagePath;
|