polotno-node 2.2.1 → 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
@@ -104,6 +104,16 @@ module.exports.createInstance = async ({
104
104
  }
105
105
  });
106
106
  }
107
+ if (args[1]?.textVerticalResizeEnabled) {
108
+ await page.evaluate(() => {
109
+ if (
110
+ window.config &&
111
+ window.config.unstable_setTextVerticalResizeEnabled
112
+ ) {
113
+ window.config.unstable_setTextVerticalResizeEnabled(true);
114
+ }
115
+ });
116
+ }
107
117
  await page.evaluate(() => {
108
118
  if (window.config?.onLoadError) {
109
119
  window.config.onLoadError((error) => {
@@ -142,6 +152,22 @@ module.exports.createInstance = async ({
142
152
  );
143
153
  };
144
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
+
145
171
  const jsonToImageBase64 = async (json, attrs) => {
146
172
  const url = await jsonToDataURL(json, attrs);
147
173
  return url.split('base64,')[1];
@@ -160,15 +186,9 @@ module.exports.createInstance = async ({
160
186
  };
161
187
 
162
188
  const jsonToBlob = async (json, attrs) => {
163
- return await run(
164
- async (json, attrs) => {
165
- store.loadJSON(json);
166
- await store.waitLoading();
167
- return await store.toBlob(attrs);
168
- },
169
- json,
170
- attrs || {}
171
- );
189
+ const base64 = await jsonToImageBase64(json, attrs);
190
+ const blob = Buffer.from(base64, 'base64');
191
+ return blob;
172
192
  };
173
193
 
174
194
  const jsonToPDFBase64 = async (json, attrs) => {
@@ -188,6 +208,8 @@ module.exports.createInstance = async ({
188
208
  jsonToPDFDataURL,
189
209
  jsonToPDFBase64,
190
210
  jsonToBlob,
211
+ jsonToGIFDataURL,
212
+ jsonToGIFBase64,
191
213
  createPage: async () => await module.exports.createPage(browser, visitPage),
192
214
  };
193
215
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.2.1",
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"