polotno-node 2.2.0 → 2.3.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.
@@ -0,0 +1,17 @@
1
+ <html>
2
+ <head>
3
+ <title>Canvas editor</title>
4
+ <style>
5
+ body {
6
+ padding: 0;
7
+ margin: 0;
8
+ }
9
+ </style>
10
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
11
+ <script type="module" crossorigin src="./assets/index-ae105516.js"></script>
12
+ </head>
13
+ <body class="bp3-dark">
14
+ <div id="root"></div>
15
+
16
+ </body>
17
+ </html>
package/index.js CHANGED
@@ -3,9 +3,10 @@ const chrome = require('@sparticuz/chromium');
3
3
 
4
4
  const os = require('os');
5
5
  const isMacOs = os.platform() === 'darwin';
6
+ const isWindows = os.platform() === 'win32' || os.platform() === 'win64';
6
7
 
7
- // load full puppeteer only on macos
8
- if (isMacOs) {
8
+ // load full puppeteer on non linux platforms
9
+ if (isMacOs || isWindows) {
9
10
  puppeteer = require('puppeteer');
10
11
  }
11
12
 
package/instance.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const path = require('path');
2
- const DEFAULT_CLIENT = `file:${path.join(__dirname, 'dist', 'client.html')}`;
2
+ const DEFAULT_CLIENT = `file:${path.join(__dirname, 'dist', 'index.html')}`;
3
3
 
4
4
  module.exports.createPage = async (browser, url) => {
5
5
  const page = await browser.newPage();
@@ -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) => {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "ava",
8
- "build": "rm -rf ./dist && parcel build ./client.html --public-url ./ && rm ./dist/*js.map",
8
+ "build": "rm -rf ./dist && npx vite build ./client/ --base=./ --outDir ../dist",
9
9
  "dev": "parcel ./client.html"
10
10
  },
11
11
  "files": [
@@ -14,18 +14,19 @@
14
14
  "instance.js",
15
15
  "README.md"
16
16
  ],
17
+ "browserslist": "> 0.5%, last 2 versions, not dead",
17
18
  "devDependencies": {
18
19
  "ava": "^5.3.1",
19
20
  "axios": "^1.4.0",
20
21
  "canvas": "^2.11.2",
21
22
  "fluent-ffmpeg": "^2.1.2",
22
23
  "gifencoder": "^2.0.1",
23
- "parcel-bundler": "^1.12.4",
24
24
  "pixelmatch": "^5.3.0",
25
25
  "pngjs": "^7.0.0",
26
26
  "polotno": "^1.9.8",
27
27
  "react": "^18.2.0",
28
- "react-dom": "^18.2.0"
28
+ "react-dom": "^18.2.0",
29
+ "vite": "^4.3.9"
29
30
  },
30
31
  "author": "Anton Lavrenov",
31
32
  "license": "MIT",