polotno-node 2.11.8 → 2.11.10

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/index.d.ts ADDED
@@ -0,0 +1,104 @@
1
+ declare module "polotno-node" {
2
+ import { Browser, Page } from "puppeteer"
3
+
4
+ // Configuration Options for Asset Loading and Rendering
5
+ export interface RenderOptions {
6
+ pixelRatio?: number
7
+ assetLoadTimeout?: number
8
+ fontLoadTimeout?: number
9
+ htmlTextRenderEnabled?: boolean
10
+ textVerticalResizeEnabled?: boolean
11
+ textSplitAllowed?: boolean
12
+ textOverflow?: string
13
+ skipFontError?: boolean
14
+ skipImageError?: boolean
15
+ mimeType?: string
16
+ onProgress?: (progress: number) => void
17
+ }
18
+
19
+ // JSON Structure for Rendering
20
+ export interface RenderJSON {
21
+ [key: string]: any
22
+ }
23
+
24
+ // Browser Creation Options
25
+ export interface BrowserOptions {
26
+ browserArgs?: string[]
27
+ headless?: "new" | boolean
28
+ protocolTimeout?: number
29
+ ignoreHTTPSErrors?: boolean
30
+ executablePath?: string
31
+ }
32
+
33
+ // Instance Creation Options
34
+ export interface InstanceOptions {
35
+ key?: string
36
+ url?: string
37
+ useParallelPages?: boolean
38
+ browserArgs?: string[]
39
+ browser?: Browser
40
+ }
41
+
42
+ // Polotno Node Instance
43
+ export interface PolotnoInstance {
44
+ close: () => Promise<void>
45
+ firstPage: Page | null
46
+ browser: Browser
47
+ run: (
48
+ func: (json: RenderJSON, options?: RenderOptions) => Promise<any>,
49
+ ...args: any[]
50
+ ) => Promise<any>
51
+ jsonToDataURL: (
52
+ json: RenderJSON,
53
+ options?: RenderOptions
54
+ ) => Promise<string>
55
+ jsonToImageBase64: (
56
+ json: RenderJSON,
57
+ options?: RenderOptions
58
+ ) => Promise<string>
59
+ jsonToPDFDataURL: (
60
+ json: RenderJSON,
61
+ options?: RenderOptions
62
+ ) => Promise<string>
63
+ jsonToPDFBase64: (
64
+ json: RenderJSON,
65
+ options?: RenderOptions
66
+ ) => Promise<string>
67
+ jsonToBlob: (json: RenderJSON, options?: RenderOptions) => Promise<Buffer>
68
+ jsonToGIFDataURL: (
69
+ json: RenderJSON,
70
+ options?: RenderOptions
71
+ ) => Promise<string>
72
+ jsonToGIFBase64: (
73
+ json: RenderJSON,
74
+ options?: RenderOptions
75
+ ) => Promise<string>
76
+ createPage: () => Promise<Page>
77
+ }
78
+
79
+ // Main Module Exports
80
+ export function createBrowser(options?: BrowserOptions): Promise<Browser>
81
+
82
+ export function createInstance(
83
+ options?: InstanceOptions
84
+ ): Promise<PolotnoInstance>
85
+
86
+ // Exported Module Functions
87
+ export function createPage(browser: Browser, url: string): Promise<Page>
88
+ export function run(page: Page, func: () => void, args: any[]): Promise<any>
89
+ export function jsonToDataURL(
90
+ page: Page,
91
+ json: RenderJSON,
92
+ attrs?: RenderOptions
93
+ ): Promise<string>
94
+ export function jsonToPDFDataURL(
95
+ page: Page,
96
+ json: RenderJSON,
97
+ attrs?: RenderOptions
98
+ ): Promise<string>
99
+ export function jsonToBlob(
100
+ page: Page,
101
+ json: RenderJSON,
102
+ attrs?: RenderOptions
103
+ ): Promise<Buffer>
104
+ }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.11.8",
3
+ "version": "2.11.10",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "scripts": {
7
8
  "test": "ava --timeout=30s --concurrency=2",
8
9
  "build": "rm -rf ./dist && npx vite build ./client/ --base=./ --outDir ../dist",
@@ -11,6 +12,7 @@
11
12
  "files": [
12
13
  "dist",
13
14
  "index.js",
15
+ "index.d.ts",
14
16
  "instance.js",
15
17
  "video-parallel.js",
16
18
  "README.md"
@@ -21,19 +23,20 @@
21
23
  "axios": "^1.8.4",
22
24
  "dotenv": "^16.4.7",
23
25
  "fluent-ffmpeg": "^2.1.3",
24
- "pixelmatch": "^6.0.0",
26
+ "jspdf": "^3.0.1",
27
+ "pixelmatch": "^7.1.0",
25
28
  "pngjs": "^7.0.0",
26
- "polotno": "^2.21.5",
29
+ "polotno": "^2.21.8",
27
30
  "react": "^18.3.1",
28
31
  "react-dom": "^18.3.1",
29
- "vite": "^6.2.2"
32
+ "vite": "^6.2.5"
30
33
  },
31
34
  "author": "Anton Lavrenov",
32
35
  "license": "MIT",
33
36
  "dependencies": {
34
37
  "@sparticuz/chromium": "^133.0.0",
35
- "puppeteer": "^24.4.0",
36
- "puppeteer-core": "^24.4.0",
38
+ "puppeteer": "^24.5.0",
39
+ "puppeteer-core": "^24.5.0",
37
40
  "tmp": "^0.2.3"
38
41
  },
39
42
  "bugs": {