@shotstack/shotstack-canvas 2.0.1 → 2.0.3
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/entry.node.cjs +10 -2
- package/dist/entry.node.d.cts +14 -0
- package/dist/entry.node.d.ts +14 -0
- package/dist/entry.node.js +10 -2
- package/dist/entry.web.d.ts +14 -0
- package/dist/entry.web.js +10 -2
- package/package.json +1 -1
package/dist/entry.node.cjs
CHANGED
|
@@ -612,7 +612,8 @@ var richCaptionAssetSchema = import_zod.z.object({
|
|
|
612
612
|
wordAnimation: richCaptionWordAnimationSchema.optional(),
|
|
613
613
|
position: import_zod.z.enum(["top", "center", "bottom"]).default("bottom"),
|
|
614
614
|
maxWidth: import_zod.z.number().min(0.1).max(1).default(0.9),
|
|
615
|
-
maxLines: import_zod.z.number().int().min(1).max(10).default(2)
|
|
615
|
+
maxLines: import_zod.z.number().int().min(1).max(10).default(2),
|
|
616
|
+
customFonts: import_zod.z.array(customFontSchema).optional()
|
|
616
617
|
}).superRefine((data, ctx) => {
|
|
617
618
|
if (data.src && data.words) {
|
|
618
619
|
ctx.addIssue({
|
|
@@ -1216,8 +1217,15 @@ var FontRegistry = class _FontRegistry {
|
|
|
1216
1217
|
if (this.registeredCanvasFonts.has(family)) {
|
|
1217
1218
|
return;
|
|
1218
1219
|
}
|
|
1220
|
+
if (typeof window !== "undefined") {
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1219
1223
|
try {
|
|
1220
|
-
const
|
|
1224
|
+
const moduleName = "canvas";
|
|
1225
|
+
const canvasMod = await import(
|
|
1226
|
+
/* @vite-ignore */
|
|
1227
|
+
moduleName
|
|
1228
|
+
);
|
|
1221
1229
|
const GlobalFonts = canvasMod.GlobalFonts;
|
|
1222
1230
|
if (GlobalFonts && typeof GlobalFonts.register === "function") {
|
|
1223
1231
|
const buffer = Buffer.from(bytes);
|
package/dist/entry.node.d.cts
CHANGED
|
@@ -373,6 +373,13 @@ declare const richCaptionAssetSchema: z.ZodObject<{
|
|
|
373
373
|
}>>;
|
|
374
374
|
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
375
375
|
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
376
|
+
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
377
|
+
src: z.ZodString;
|
|
378
|
+
family: z.ZodString;
|
|
379
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
380
|
+
style: z.ZodOptional<z.ZodString>;
|
|
381
|
+
originalFamily: z.ZodOptional<z.ZodString>;
|
|
382
|
+
}, z.core.$strip>>>;
|
|
376
383
|
}, z.core.$strip>;
|
|
377
384
|
declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
378
385
|
type: z.ZodLiteral<"rich-caption">;
|
|
@@ -492,6 +499,13 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
|
492
499
|
}>>;
|
|
493
500
|
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
494
501
|
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
502
|
+
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
503
|
+
src: z.ZodString;
|
|
504
|
+
family: z.ZodString;
|
|
505
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
506
|
+
style: z.ZodOptional<z.ZodString>;
|
|
507
|
+
originalFamily: z.ZodOptional<z.ZodString>;
|
|
508
|
+
}, z.core.$strip>>>;
|
|
495
509
|
}, z.core.$strip>;
|
|
496
510
|
type CanvasRichCaptionAsset = z.infer<typeof CanvasRichCaptionAssetSchema>;
|
|
497
511
|
type CanvasSvgAsset = z.infer<typeof CanvasSvgAssetSchema>;
|
package/dist/entry.node.d.ts
CHANGED
|
@@ -373,6 +373,13 @@ declare const richCaptionAssetSchema: z.ZodObject<{
|
|
|
373
373
|
}>>;
|
|
374
374
|
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
375
375
|
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
376
|
+
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
377
|
+
src: z.ZodString;
|
|
378
|
+
family: z.ZodString;
|
|
379
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
380
|
+
style: z.ZodOptional<z.ZodString>;
|
|
381
|
+
originalFamily: z.ZodOptional<z.ZodString>;
|
|
382
|
+
}, z.core.$strip>>>;
|
|
376
383
|
}, z.core.$strip>;
|
|
377
384
|
declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
378
385
|
type: z.ZodLiteral<"rich-caption">;
|
|
@@ -492,6 +499,13 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
|
492
499
|
}>>;
|
|
493
500
|
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
494
501
|
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
502
|
+
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
503
|
+
src: z.ZodString;
|
|
504
|
+
family: z.ZodString;
|
|
505
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
506
|
+
style: z.ZodOptional<z.ZodString>;
|
|
507
|
+
originalFamily: z.ZodOptional<z.ZodString>;
|
|
508
|
+
}, z.core.$strip>>>;
|
|
495
509
|
}, z.core.$strip>;
|
|
496
510
|
type CanvasRichCaptionAsset = z.infer<typeof CanvasRichCaptionAssetSchema>;
|
|
497
511
|
type CanvasSvgAsset = z.infer<typeof CanvasSvgAssetSchema>;
|
package/dist/entry.node.js
CHANGED
|
@@ -224,7 +224,8 @@ var richCaptionAssetSchema = z.object({
|
|
|
224
224
|
wordAnimation: richCaptionWordAnimationSchema.optional(),
|
|
225
225
|
position: z.enum(["top", "center", "bottom"]).default("bottom"),
|
|
226
226
|
maxWidth: z.number().min(0.1).max(1).default(0.9),
|
|
227
|
-
maxLines: z.number().int().min(1).max(10).default(2)
|
|
227
|
+
maxLines: z.number().int().min(1).max(10).default(2),
|
|
228
|
+
customFonts: z.array(customFontSchema).optional()
|
|
228
229
|
}).superRefine((data, ctx) => {
|
|
229
230
|
if (data.src && data.words) {
|
|
230
231
|
ctx.addIssue({
|
|
@@ -827,8 +828,15 @@ var FontRegistry = class _FontRegistry {
|
|
|
827
828
|
if (this.registeredCanvasFonts.has(family)) {
|
|
828
829
|
return;
|
|
829
830
|
}
|
|
831
|
+
if (typeof window !== "undefined") {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
830
834
|
try {
|
|
831
|
-
const
|
|
835
|
+
const moduleName = "canvas";
|
|
836
|
+
const canvasMod = await import(
|
|
837
|
+
/* @vite-ignore */
|
|
838
|
+
moduleName
|
|
839
|
+
);
|
|
832
840
|
const GlobalFonts = canvasMod.GlobalFonts;
|
|
833
841
|
if (GlobalFonts && typeof GlobalFonts.register === "function") {
|
|
834
842
|
const buffer = Buffer.from(bytes);
|
package/dist/entry.web.d.ts
CHANGED
|
@@ -373,6 +373,13 @@ declare const richCaptionAssetSchema: z.ZodObject<{
|
|
|
373
373
|
}>>;
|
|
374
374
|
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
375
375
|
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
376
|
+
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
377
|
+
src: z.ZodString;
|
|
378
|
+
family: z.ZodString;
|
|
379
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
380
|
+
style: z.ZodOptional<z.ZodString>;
|
|
381
|
+
originalFamily: z.ZodOptional<z.ZodString>;
|
|
382
|
+
}, z.core.$strip>>>;
|
|
376
383
|
}, z.core.$strip>;
|
|
377
384
|
declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
378
385
|
type: z.ZodLiteral<"rich-caption">;
|
|
@@ -492,6 +499,13 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
|
492
499
|
}>>;
|
|
493
500
|
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
494
501
|
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
502
|
+
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
503
|
+
src: z.ZodString;
|
|
504
|
+
family: z.ZodString;
|
|
505
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
506
|
+
style: z.ZodOptional<z.ZodString>;
|
|
507
|
+
originalFamily: z.ZodOptional<z.ZodString>;
|
|
508
|
+
}, z.core.$strip>>>;
|
|
495
509
|
}, z.core.$strip>;
|
|
496
510
|
type CanvasRichCaptionAsset = z.infer<typeof CanvasRichCaptionAssetSchema>;
|
|
497
511
|
type CanvasSvgAsset = z.infer<typeof CanvasSvgAssetSchema>;
|
package/dist/entry.web.js
CHANGED
|
@@ -18102,7 +18102,8 @@ var richCaptionAssetSchema = external_exports.object({
|
|
|
18102
18102
|
wordAnimation: richCaptionWordAnimationSchema.optional(),
|
|
18103
18103
|
position: external_exports.enum(["top", "center", "bottom"]).default("bottom"),
|
|
18104
18104
|
maxWidth: external_exports.number().min(0.1).max(1).default(0.9),
|
|
18105
|
-
maxLines: external_exports.number().int().min(1).max(10).default(2)
|
|
18105
|
+
maxLines: external_exports.number().int().min(1).max(10).default(2),
|
|
18106
|
+
customFonts: external_exports.array(customFontSchema).optional()
|
|
18106
18107
|
}).superRefine((data, ctx) => {
|
|
18107
18108
|
if (data.src && data.words) {
|
|
18108
18109
|
ctx.addIssue({
|
|
@@ -32095,8 +32096,15 @@ var _FontRegistry = class _FontRegistry {
|
|
|
32095
32096
|
if (this.registeredCanvasFonts.has(family)) {
|
|
32096
32097
|
return;
|
|
32097
32098
|
}
|
|
32099
|
+
if (typeof window !== "undefined") {
|
|
32100
|
+
return;
|
|
32101
|
+
}
|
|
32098
32102
|
try {
|
|
32099
|
-
const
|
|
32103
|
+
const moduleName = "canvas";
|
|
32104
|
+
const canvasMod = await import(
|
|
32105
|
+
/* @vite-ignore */
|
|
32106
|
+
moduleName
|
|
32107
|
+
);
|
|
32100
32108
|
const GlobalFonts = canvasMod.GlobalFonts;
|
|
32101
32109
|
if (GlobalFonts && typeof GlobalFonts.register === "function") {
|
|
32102
32110
|
const buffer = Buffer.from(bytes);
|
package/package.json
CHANGED