polotno-node 2.3.0 → 2.4.0

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-ae105516.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-b2f4e4ff.js"></script>
12
12
  </head>
13
13
  <body class="bp3-dark">
14
14
  <div id="root"></div>
package/instance.js CHANGED
@@ -152,6 +152,22 @@ module.exports.createInstance = async ({
152
152
  );
153
153
  };
154
154
 
155
+ const jsonToGIFDataURL = async (json, attrs) => {
156
+ return await run(
157
+ async (json, attrs) => {
158
+ store.loadJSON(json);
159
+ return await store.toGIFDataURL(attrs);
160
+ },
161
+ json,
162
+ attrs || {}
163
+ );
164
+ };
165
+
166
+ const jsonToGIFBase64 = async (json, attrs) => {
167
+ const url = await jsonToGIFDataURL(json, attrs);
168
+ return url.split('base64,')[1];
169
+ };
170
+
155
171
  const jsonToImageBase64 = async (json, attrs) => {
156
172
  const url = await jsonToDataURL(json, attrs);
157
173
  return url.split('base64,')[1];
@@ -170,15 +186,9 @@ module.exports.createInstance = async ({
170
186
  };
171
187
 
172
188
  const jsonToBlob = async (json, attrs) => {
173
- return await run(
174
- async (json, attrs) => {
175
- store.loadJSON(json);
176
- await store.waitLoading();
177
- return await store.toBlob(attrs);
178
- },
179
- json,
180
- attrs || {}
181
- );
189
+ const base64 = await jsonToImageBase64(json, attrs);
190
+ const blob = Buffer.from(base64, 'base64');
191
+ return blob;
182
192
  };
183
193
 
184
194
  const jsonToPDFBase64 = async (json, attrs) => {
@@ -198,6 +208,8 @@ module.exports.createInstance = async ({
198
208
  jsonToPDFDataURL,
199
209
  jsonToPDFBase64,
200
210
  jsonToBlob,
211
+ jsonToGIFDataURL,
212
+ jsonToGIFBase64,
201
213
  createPage: async () => await module.exports.createPage(browser, visitPage),
202
214
  };
203
215
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,17 +23,17 @@
23
23
  "gifencoder": "^2.0.1",
24
24
  "pixelmatch": "^5.3.0",
25
25
  "pngjs": "^7.0.0",
26
- "polotno": "^1.9.8",
26
+ "polotno": "^1.11.1",
27
27
  "react": "^18.2.0",
28
28
  "react-dom": "^18.2.0",
29
- "vite": "^4.3.9"
29
+ "vite": "^4.4.3"
30
30
  },
31
31
  "author": "Anton Lavrenov",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
34
  "@sparticuz/chromium": "114.0.0",
35
- "puppeteer": "^20.7.2",
36
- "puppeteer-core": "^20.7.2"
35
+ "puppeteer": "^20.8.1",
36
+ "puppeteer-core": "^20.8.1"
37
37
  },
38
38
  "bugs": {
39
39
  "url": "https://github.com/polotno-project/polotno-node/issues"