@shotstack/shotstack-canvas 1.3.5 → 1.3.7

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.
@@ -48,7 +48,7 @@ var CANVAS_CONFIG = {
48
48
  fontFamily: "Roboto",
49
49
  fontSize: 48,
50
50
  color: "#000000",
51
- textAlign: "left"
51
+ textAlign: "center"
52
52
  },
53
53
  LIMITS: {
54
54
  minWidth: 1,
@@ -1940,7 +1940,7 @@ var VideoGenerator = class {
1940
1940
  ffmpeg.on("close", (code) => {
1941
1941
  if (code === 0) {
1942
1942
  console.log("\u2705 Video generation complete!");
1943
- resolve();
1943
+ resolve(finalOutputPath);
1944
1944
  } else {
1945
1945
  console.error("FFmpeg stderr:", ffmpegError);
1946
1946
  reject(new Error(`FFmpeg exited with code ${code}`));
@@ -2119,7 +2119,10 @@ async function createTextEngine(opts = {}) {
2119
2119
  },
2120
2120
  stroke: asset.stroke,
2121
2121
  shadow: asset.shadow,
2122
- align: asset.align ?? { horizontal: "left", vertical: "middle" },
2122
+ align: {
2123
+ horizontal: asset.align?.horizontal ?? "center",
2124
+ vertical: asset.align?.vertical ?? "middle"
2125
+ },
2123
2126
  background: asset.background,
2124
2127
  glyphPathProvider: (gid) => fonts.glyphPath(desc, gid),
2125
2128
  getUnitsPerEm: () => fonts.getUnitsPerEm(desc)
@@ -2189,7 +2192,8 @@ async function createTextEngine(opts = {}) {
2189
2192
  const frameGenerator = async (time) => {
2190
2193
  return this.renderFrame(asset, time);
2191
2194
  };
2192
- await videoGenerator.generateVideo(frameGenerator, finalOptions);
2195
+ const actualOutputPath = await videoGenerator.generateVideo(frameGenerator, finalOptions);
2196
+ return actualOutputPath;
2193
2197
  } catch (err) {
2194
2198
  throw new Error(
2195
2199
  `Failed to generate video: ${err instanceof Error ? err.message : String(err)}`
@@ -6,7 +6,7 @@ declare const CANVAS_CONFIG: {
6
6
  fontFamily: string;
7
7
  fontSize: number;
8
8
  color: string;
9
- textAlign: "left";
9
+ textAlign: "center";
10
10
  };
11
11
  LIMITS: {
12
12
  minWidth: number;
@@ -243,7 +243,7 @@ declare function createTextEngine(opts?: {
243
243
  render(ops: DrawOp[]): Promise<void>;
244
244
  toPNG(): Promise<Buffer>;
245
245
  }>;
246
- generateVideo(asset: RichTextValidated, options: Partial<VideoGenerationOptions>): Promise<void>;
246
+ generateVideo(asset: RichTextValidated, options: Partial<VideoGenerationOptions>): Promise<string>;
247
247
  destroy(): void;
248
248
  }>;
249
249
 
@@ -6,7 +6,7 @@ declare const CANVAS_CONFIG: {
6
6
  fontFamily: string;
7
7
  fontSize: number;
8
8
  color: string;
9
- textAlign: "left";
9
+ textAlign: "center";
10
10
  };
11
11
  LIMITS: {
12
12
  minWidth: number;
@@ -243,7 +243,7 @@ declare function createTextEngine(opts?: {
243
243
  render(ops: DrawOp[]): Promise<void>;
244
244
  toPNG(): Promise<Buffer>;
245
245
  }>;
246
- generateVideo(asset: RichTextValidated, options: Partial<VideoGenerationOptions>): Promise<void>;
246
+ generateVideo(asset: RichTextValidated, options: Partial<VideoGenerationOptions>): Promise<string>;
247
247
  destroy(): void;
248
248
  }>;
249
249
 
@@ -10,7 +10,7 @@ var CANVAS_CONFIG = {
10
10
  fontFamily: "Roboto",
11
11
  fontSize: 48,
12
12
  color: "#000000",
13
- textAlign: "left"
13
+ textAlign: "center"
14
14
  },
15
15
  LIMITS: {
16
16
  minWidth: 1,
@@ -1901,7 +1901,7 @@ var VideoGenerator = class {
1901
1901
  ffmpeg.on("close", (code) => {
1902
1902
  if (code === 0) {
1903
1903
  console.log("\u2705 Video generation complete!");
1904
- resolve();
1904
+ resolve(finalOutputPath);
1905
1905
  } else {
1906
1906
  console.error("FFmpeg stderr:", ffmpegError);
1907
1907
  reject(new Error(`FFmpeg exited with code ${code}`));
@@ -2080,7 +2080,10 @@ async function createTextEngine(opts = {}) {
2080
2080
  },
2081
2081
  stroke: asset.stroke,
2082
2082
  shadow: asset.shadow,
2083
- align: asset.align ?? { horizontal: "left", vertical: "middle" },
2083
+ align: {
2084
+ horizontal: asset.align?.horizontal ?? "center",
2085
+ vertical: asset.align?.vertical ?? "middle"
2086
+ },
2084
2087
  background: asset.background,
2085
2088
  glyphPathProvider: (gid) => fonts.glyphPath(desc, gid),
2086
2089
  getUnitsPerEm: () => fonts.getUnitsPerEm(desc)
@@ -2150,7 +2153,8 @@ async function createTextEngine(opts = {}) {
2150
2153
  const frameGenerator = async (time) => {
2151
2154
  return this.renderFrame(asset, time);
2152
2155
  };
2153
- await videoGenerator.generateVideo(frameGenerator, finalOptions);
2156
+ const actualOutputPath = await videoGenerator.generateVideo(frameGenerator, finalOptions);
2157
+ return actualOutputPath;
2154
2158
  } catch (err) {
2155
2159
  throw new Error(
2156
2160
  `Failed to generate video: ${err instanceof Error ? err.message : String(err)}`
@@ -6,7 +6,7 @@ declare const CANVAS_CONFIG: {
6
6
  fontFamily: string;
7
7
  fontSize: number;
8
8
  color: string;
9
- textAlign: "left";
9
+ textAlign: "center";
10
10
  };
11
11
  LIMITS: {
12
12
  minWidth: number;
package/dist/entry.web.js CHANGED
@@ -14,7 +14,7 @@ var CANVAS_CONFIG = {
14
14
  fontFamily: "Roboto",
15
15
  fontSize: 48,
16
16
  color: "#000000",
17
- textAlign: "left"
17
+ textAlign: "center"
18
18
  },
19
19
  LIMITS: {
20
20
  minWidth: 1,
@@ -1801,7 +1801,10 @@ async function createTextEngine(opts = {}) {
1801
1801
  },
1802
1802
  stroke: asset.stroke,
1803
1803
  shadow: asset.shadow,
1804
- align: asset.align ?? { horizontal: "center", vertical: "middle" },
1804
+ align: {
1805
+ horizontal: asset.align?.horizontal ?? "center",
1806
+ vertical: asset.align?.vertical ?? "middle"
1807
+ },
1805
1808
  background: asset.background,
1806
1809
  glyphPathProvider: (gid) => fonts.glyphPath(desc, gid),
1807
1810
  getUnitsPerEm: () => fonts.getUnitsPerEm(desc)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/shotstack-canvas",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "Text layout & animation engine (HarfBuzz) for Node & Web - fully self-contained.",
5
5
  "type": "module",
6
6
  "main": "./dist/entry.node.cjs",