polotno-node 2.9.33 → 2.9.35

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/index.html CHANGED
@@ -8,7 +8,7 @@
8
8
  }
9
9
  </style>
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1" />
11
- <script type="module" crossorigin src="./assets/index-BnTpuNs2.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-DsVyOnN0.js"></script>
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
package/instance.js CHANGED
@@ -147,6 +147,12 @@ module.exports.createInstance = async ({
147
147
  }
148
148
  });
149
149
  }
150
+ if (args[1]?.onProgress) {
151
+ const originalProgress = args[1].onProgress;
152
+ await page.exposeFunction('onProgress', async (progress) => {
153
+ originalProgress(progress);
154
+ });
155
+ }
150
156
  if (args[1]?.textOverflow) {
151
157
  await page.evaluate((overflow) => {
152
158
  if (window.config && window.config.unstable_setTextOverflow) {
@@ -242,6 +248,11 @@ module.exports.createInstance = async ({
242
248
  return await run(
243
249
  async (json, attrs) => {
244
250
  store.loadJSON(json);
251
+ if (window.onProgress) {
252
+ attrs.onProgress = (progress) => {
253
+ window.onProgress(progress);
254
+ };
255
+ }
245
256
  await store.waitLoading();
246
257
  return await store.toPDFDataURL(attrs);
247
258
  },
@@ -250,17 +261,17 @@ module.exports.createInstance = async ({
250
261
  );
251
262
  };
252
263
 
264
+ const jsonToPDFBase64 = async (json, attrs) => {
265
+ const url = await jsonToPDFDataURL(json, attrs);
266
+ return url.split('base64,')[1];
267
+ };
268
+
253
269
  const jsonToBlob = async (json, attrs) => {
254
270
  const base64 = await jsonToImageBase64(json, attrs);
255
271
  const blob = Buffer.from(base64, 'base64');
256
272
  return blob;
257
273
  };
258
274
 
259
- const jsonToPDFBase64 = async (json, attrs) => {
260
- const url = await jsonToPDFDataURL(json, attrs);
261
- return url.split('base64,')[1];
262
- };
263
-
264
275
  return {
265
276
  close: async () => {
266
277
  await browser.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.9.33",
3
+ "version": "2.9.35",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "gifencoder": "^2.0.1",
27
27
  "pixelmatch": "^6.0.0",
28
28
  "pngjs": "^7.0.0",
29
- "polotno": "^2.10.11",
29
+ "polotno": "^2.11.2",
30
30
  "react": "^18.3.1",
31
31
  "react-dom": "^18.3.1",
32
32
  "vite": "^5.3.4"