polotno-node 2.9.7 → 2.9.9
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/README.md +9 -1
- package/dist/assets/{index-30-BPj2-.js → index-DsJ35GHi.js} +106 -68
- package/dist/index.html +1 -1
- package/instance.js +31 -0
- package/package.json +2 -2
- package/video-parallel.js +2 -5
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-DsJ35GHi.js"></script>
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
package/instance.js
CHANGED
|
@@ -104,6 +104,21 @@ module.exports.createInstance = async ({
|
|
|
104
104
|
await page.evaluate((timeout) => {
|
|
105
105
|
if (window.config && window.config.setAssetLoadTimeout) {
|
|
106
106
|
window.config.setAssetLoadTimeout(timeout);
|
|
107
|
+
} else {
|
|
108
|
+
console.error(
|
|
109
|
+
'setAssetLoadTimeout function is not defined in the client.'
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}, args[1].assetLoadTimeout);
|
|
113
|
+
}
|
|
114
|
+
if (args[1]?.fontLoadTimeout) {
|
|
115
|
+
await page.evaluate((timeout) => {
|
|
116
|
+
if (window.config && window.config.setFontLoadTimeout) {
|
|
117
|
+
window.config.setFontLoadTimeout(timeout);
|
|
118
|
+
} else {
|
|
119
|
+
console.error(
|
|
120
|
+
'setFontLoadTimeout function is not defined in the client.'
|
|
121
|
+
);
|
|
107
122
|
}
|
|
108
123
|
}, args[1].assetLoadTimeout);
|
|
109
124
|
}
|
|
@@ -111,6 +126,10 @@ module.exports.createInstance = async ({
|
|
|
111
126
|
await page.evaluate(() => {
|
|
112
127
|
if (window.config && window.config.unstable_useHtmlTextRender) {
|
|
113
128
|
window.config.unstable_useHtmlTextRender(true);
|
|
129
|
+
} else {
|
|
130
|
+
console.error(
|
|
131
|
+
'unstable_useHtmlTextRender function is not defined in the client.'
|
|
132
|
+
);
|
|
114
133
|
}
|
|
115
134
|
});
|
|
116
135
|
}
|
|
@@ -121,6 +140,10 @@ module.exports.createInstance = async ({
|
|
|
121
140
|
window.config.unstable_setTextVerticalResizeEnabled
|
|
122
141
|
) {
|
|
123
142
|
window.config.unstable_setTextVerticalResizeEnabled(true);
|
|
143
|
+
} else {
|
|
144
|
+
console.error(
|
|
145
|
+
'unstable_setTextVerticalResizeEnabled function is not defined in the client.'
|
|
146
|
+
);
|
|
124
147
|
}
|
|
125
148
|
});
|
|
126
149
|
}
|
|
@@ -128,6 +151,10 @@ module.exports.createInstance = async ({
|
|
|
128
151
|
await page.evaluate((overflow) => {
|
|
129
152
|
if (window.config && window.config.unstable_setTextOverflow) {
|
|
130
153
|
window.config.unstable_setTextOverflow(overflow);
|
|
154
|
+
} else {
|
|
155
|
+
console.error(
|
|
156
|
+
'unstable_setTextOverflow function is not defined in the client.'
|
|
157
|
+
);
|
|
131
158
|
}
|
|
132
159
|
}, args[1].textOverflow);
|
|
133
160
|
}
|
|
@@ -136,6 +163,10 @@ module.exports.createInstance = async ({
|
|
|
136
163
|
window.config.onLoadError((error) => {
|
|
137
164
|
window._polotnoError = error;
|
|
138
165
|
});
|
|
166
|
+
} else {
|
|
167
|
+
console.error(
|
|
168
|
+
'onLoadError function is not defined in the client. Error handling will not work.'
|
|
169
|
+
);
|
|
139
170
|
}
|
|
140
171
|
});
|
|
141
172
|
const result = await page.evaluate(func, ...args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polotno-node",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.9",
|
|
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": "^5.3.0",
|
|
28
28
|
"pngjs": "^7.0.0",
|
|
29
|
-
"polotno": "^2.4.
|
|
29
|
+
"polotno": "^2.4.31",
|
|
30
30
|
"react": "^18.2.0",
|
|
31
31
|
"react-dom": "^18.2.0",
|
|
32
32
|
"vite": "^5.2.9"
|
package/video-parallel.js
CHANGED
|
@@ -23,7 +23,6 @@ const downloadVideo = async (url, destination) => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// 2. Convert it into webm format
|
|
26
|
-
|
|
27
26
|
const convertToWebM = (input, output) => {
|
|
28
27
|
return new Promise((resolve, reject) => {
|
|
29
28
|
ffmpeg(input)
|
|
@@ -74,9 +73,7 @@ const cachedVideoToDataURL = async (url) => {
|
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
function printProgress(progress) {
|
|
77
|
-
|
|
78
|
-
process.stdout.cursorTo(0);
|
|
79
|
-
process.stdout.write('Rendering frame: ' + progress + '%');
|
|
76
|
+
console.log('Rendering frame: ' + progress + '%');
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
module.exports.jsonToVideo = async function jsonToVideo(
|
|
@@ -103,7 +100,7 @@ module.exports.jsonToVideo = async function jsonToVideo(
|
|
|
103
100
|
);
|
|
104
101
|
|
|
105
102
|
const duration = json.pages.reduce((acc, page) => {
|
|
106
|
-
return acc + page.duration;
|
|
103
|
+
return acc + (page.duration ?? 5000);
|
|
107
104
|
}, 0);
|
|
108
105
|
const parallel = attrs.parallel || 5;
|
|
109
106
|
|