@shotstack/shotstack-canvas 1.5.0 → 1.5.2

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.
@@ -172,9 +172,7 @@ var RichTextAssetSchema = import_joi.default.object({
172
172
  padding: paddingSchema.optional(),
173
173
  align: alignmentSchema.optional(),
174
174
  animation: animationSchema.optional(),
175
- customFonts: import_joi.default.array().items(customFontSchema).optional(),
176
- cacheEnabled: import_joi.default.boolean().default(true),
177
- pixelRatio: import_joi.default.number().min(1).max(3).default(CANVAS_CONFIG.DEFAULTS.pixelRatio)
175
+ customFonts: import_joi.default.array().items(customFontSchema).optional()
178
176
  }).unknown(false);
179
177
 
180
178
  // src/wasm/hb-loader.ts
@@ -1700,16 +1698,16 @@ async function createNodePainter(opts) {
1700
1698
  for (const op of ops) {
1701
1699
  if (op.op === "BeginFrame") {
1702
1700
  const dpr = op.pixelRatio ?? opts.pixelRatio;
1703
- const wantW = Math.floor(op.width * dpr);
1704
- const wantH = Math.floor(op.height * dpr);
1701
+ const wantW = Math.floor(op.width);
1702
+ const wantH = Math.floor(op.height);
1705
1703
  if (canvas.width !== wantW || canvas.height !== wantH) {
1706
1704
  canvas.width = wantW;
1707
1705
  canvas.height = wantH;
1708
1706
  offscreenCanvas.width = wantW;
1709
1707
  offscreenCanvas.height = wantH;
1710
1708
  }
1711
- ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
1712
- offscreenCtx.setTransform(dpr, 0, 0, dpr, 0, 0);
1709
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
1710
+ offscreenCtx.setTransform(1, 0, 0, 1, 0, 0);
1713
1711
  const hasBackground = !!(op.bg && op.bg.color);
1714
1712
  needsAlphaExtraction = !hasBackground;
1715
1713
  if (op.bg && op.bg.color) {
@@ -2435,7 +2433,7 @@ async function createTextEngine(opts = {}) {
2435
2433
  };
2436
2434
  const canvasW = (asset.width ?? width) + padding.left + padding.right;
2437
2435
  const canvasH = (asset.height ?? height) + padding.top + padding.bottom;
2438
- const canvasPR = asset.pixelRatio ?? pixelRatio;
2436
+ const canvasPR = pixelRatio;
2439
2437
  let ops0;
2440
2438
  try {
2441
2439
  ops0 = await buildDrawOps({
@@ -2524,7 +2522,7 @@ async function createTextEngine(opts = {}) {
2524
2522
  fps,
2525
2523
  duration: options.duration ?? 3,
2526
2524
  outputPath: options.outputPath ?? "output.mp4",
2527
- pixelRatio: asset.pixelRatio ?? pixelRatio,
2525
+ pixelRatio,
2528
2526
  hasAlpha: needsAlpha,
2529
2527
  ...options
2530
2528
  };
@@ -94,8 +94,6 @@ type RichTextValidated = Required<{
94
94
  style?: string;
95
95
  originalFamily?: string;
96
96
  }[];
97
- cacheEnabled: boolean;
98
- pixelRatio: number;
99
97
  }>;
100
98
 
101
99
  type RGBA = {
@@ -94,8 +94,6 @@ type RichTextValidated = Required<{
94
94
  style?: string;
95
95
  originalFamily?: string;
96
96
  }[];
97
- cacheEnabled: boolean;
98
- pixelRatio: number;
99
97
  }>;
100
98
 
101
99
  type RGBA = {
@@ -134,9 +134,7 @@ var RichTextAssetSchema = Joi.object({
134
134
  padding: paddingSchema.optional(),
135
135
  align: alignmentSchema.optional(),
136
136
  animation: animationSchema.optional(),
137
- customFonts: Joi.array().items(customFontSchema).optional(),
138
- cacheEnabled: Joi.boolean().default(true),
139
- pixelRatio: Joi.number().min(1).max(3).default(CANVAS_CONFIG.DEFAULTS.pixelRatio)
137
+ customFonts: Joi.array().items(customFontSchema).optional()
140
138
  }).unknown(false);
141
139
 
142
140
  // src/wasm/hb-loader.ts
@@ -1661,16 +1659,16 @@ async function createNodePainter(opts) {
1661
1659
  for (const op of ops) {
1662
1660
  if (op.op === "BeginFrame") {
1663
1661
  const dpr = op.pixelRatio ?? opts.pixelRatio;
1664
- const wantW = Math.floor(op.width * dpr);
1665
- const wantH = Math.floor(op.height * dpr);
1662
+ const wantW = Math.floor(op.width);
1663
+ const wantH = Math.floor(op.height);
1666
1664
  if (canvas.width !== wantW || canvas.height !== wantH) {
1667
1665
  canvas.width = wantW;
1668
1666
  canvas.height = wantH;
1669
1667
  offscreenCanvas.width = wantW;
1670
1668
  offscreenCanvas.height = wantH;
1671
1669
  }
1672
- ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
1673
- offscreenCtx.setTransform(dpr, 0, 0, dpr, 0, 0);
1670
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
1671
+ offscreenCtx.setTransform(1, 0, 0, 1, 0, 0);
1674
1672
  const hasBackground = !!(op.bg && op.bg.color);
1675
1673
  needsAlphaExtraction = !hasBackground;
1676
1674
  if (op.bg && op.bg.color) {
@@ -2396,7 +2394,7 @@ async function createTextEngine(opts = {}) {
2396
2394
  };
2397
2395
  const canvasW = (asset.width ?? width) + padding.left + padding.right;
2398
2396
  const canvasH = (asset.height ?? height) + padding.top + padding.bottom;
2399
- const canvasPR = asset.pixelRatio ?? pixelRatio;
2397
+ const canvasPR = pixelRatio;
2400
2398
  let ops0;
2401
2399
  try {
2402
2400
  ops0 = await buildDrawOps({
@@ -2485,7 +2483,7 @@ async function createTextEngine(opts = {}) {
2485
2483
  fps,
2486
2484
  duration: options.duration ?? 3,
2487
2485
  outputPath: options.outputPath ?? "output.mp4",
2488
- pixelRatio: asset.pixelRatio ?? pixelRatio,
2486
+ pixelRatio,
2489
2487
  hasAlpha: needsAlpha,
2490
2488
  ...options
2491
2489
  };
@@ -94,8 +94,6 @@ type RichTextValidated = Required<{
94
94
  style?: string;
95
95
  originalFamily?: string;
96
96
  }[];
97
- cacheEnabled: boolean;
98
- pixelRatio: number;
99
97
  }>;
100
98
 
101
99
  type RGBA = {
package/dist/entry.web.js CHANGED
@@ -138,9 +138,7 @@ var RichTextAssetSchema = Joi.object({
138
138
  padding: paddingSchema.optional(),
139
139
  align: alignmentSchema.optional(),
140
140
  animation: animationSchema.optional(),
141
- customFonts: Joi.array().items(customFontSchema).optional(),
142
- cacheEnabled: Joi.boolean().default(true),
143
- pixelRatio: Joi.number().min(1).max(3).default(CANVAS_CONFIG.DEFAULTS.pixelRatio)
141
+ customFonts: Joi.array().items(customFontSchema).optional()
144
142
  }).unknown(false);
145
143
 
146
144
  // src/wasm/hb-loader.ts
@@ -338,12 +336,12 @@ async function initHB(wasmBaseURL) {
338
336
  console.log(`\u{1F30D} Set global Module.wasmBinary (${wasmBinary.byteLength} bytes)`);
339
337
  }
340
338
  console.log("\u{1F504} Importing harfbuzzjs/hb.js (factory)");
341
- const hbModule = await import("./hb-KXF2MJ2J.js");
339
+ const hbModule = await import("./hb-ODWKSLMB.js");
342
340
  const hbFactory = hbModule.default || hbModule;
343
341
  console.log("\u{1F504} Calling hb factory with wasmBinary");
344
342
  const hbInstance = await hbFactory({ wasmBinary });
345
343
  console.log("\u{1F504} Importing harfbuzzjs/hbjs.js (wrapper)");
346
- const hbjsModule = await import("./hbjs-ZTRARROF.js");
344
+ const hbjsModule = await import("./hbjs-HHU2TAW7.js");
347
345
  const hbjsWrapper = hbjsModule.default || hbjsModule;
348
346
  console.log("\u{1F504} Wrapping hb instance");
349
347
  const hb = hbjsWrapper(hbInstance);
@@ -2119,7 +2117,7 @@ async function createTextEngine(opts = {}) {
2119
2117
  };
2120
2118
  const canvasW = (asset.width ?? width) + padding.left + padding.right;
2121
2119
  const canvasH = (asset.height ?? height) + padding.top + padding.bottom;
2122
- const canvasPR = asset.pixelRatio ?? pixelRatio;
2120
+ const canvasPR = pixelRatio;
2123
2121
  let ops0;
2124
2122
  try {
2125
2123
  ops0 = await buildDrawOps({
@@ -4,9 +4,9 @@ import {
4
4
  __require
5
5
  } from "./chunk-HYGMWVDX.js";
6
6
 
7
- // node_modules/harfbuzzjs/hb.js
7
+ // node_modules/.pnpm/harfbuzzjs@0.4.12/node_modules/harfbuzzjs/hb.js
8
8
  var require_hb = __commonJS({
9
- "node_modules/harfbuzzjs/hb.js"(exports, module) {
9
+ "node_modules/.pnpm/harfbuzzjs@0.4.12/node_modules/harfbuzzjs/hb.js"(exports, module) {
10
10
  var createHarfBuzz = (() => {
11
11
  var _scriptName = typeof document != "undefined" ? document.currentScript?.src : void 0;
12
12
  return async function(moduleArg = {}) {
@@ -2,9 +2,9 @@ import {
2
2
  __commonJS
3
3
  } from "./chunk-HYGMWVDX.js";
4
4
 
5
- // node_modules/harfbuzzjs/hbjs.js
5
+ // node_modules/.pnpm/harfbuzzjs@0.4.12/node_modules/harfbuzzjs/hbjs.js
6
6
  var require_hbjs = __commonJS({
7
- "node_modules/harfbuzzjs/hbjs.js"(exports, module) {
7
+ "node_modules/.pnpm/harfbuzzjs@0.4.12/node_modules/harfbuzzjs/hbjs.js"(exports, module) {
8
8
  function hbjs(Module) {
9
9
  "use strict";
10
10
  var exports2 = Module.wasmExports;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/shotstack-canvas",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
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",