polotno-node 2.9.32 → 2.9.34
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/assets/index-DcPAu4G1.js +298 -0
- package/dist/index.html +1 -1
- package/instance.js +16 -5
- package/package.json +2 -2
- package/video-parallel.js +3 -0
- package/dist/assets/index-BnTpuNs2.js +0 -298
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-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-DcPAu4G1.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.
|
|
3
|
+
"version": "2.9.34",
|
|
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.
|
|
29
|
+
"polotno": "^2.11.1",
|
|
30
30
|
"react": "^18.3.1",
|
|
31
31
|
"react-dom": "^18.3.1",
|
|
32
32
|
"vite": "^5.3.4"
|
package/video-parallel.js
CHANGED
|
@@ -31,6 +31,9 @@ const convertToWebM = (input, output) => {
|
|
|
31
31
|
'-b:v 0',
|
|
32
32
|
'-b:a 128k',
|
|
33
33
|
'-c:a libopus',
|
|
34
|
+
'-cpu-used 4', // Faster encoding with slight quality loss
|
|
35
|
+
'-deadline realtime', // Fastest encoding mode
|
|
36
|
+
'-threads 0', // Use all available CPU cores
|
|
34
37
|
])
|
|
35
38
|
.output(output)
|
|
36
39
|
.on('end', () => {
|