html2canvas-pro 2.5.2 → 2.5.4
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 +2 -2
- package/dist/html2canvas-pro.cjs +175 -25
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +175 -25
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +175 -25
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +6 -6
- package/dist/types/core/constants.d.ts +11 -0
- package/dist/types/dom/iframe-mount.d.ts +25 -0
- package/package.json +18 -19
|
@@ -16,12 +16,23 @@ export declare const DEFAULT_IMAGE_TIMEOUT_MS = 15000;
|
|
|
16
16
|
export declare const SHADOW_MASK_OFFSET = 10000;
|
|
17
17
|
/** Polling interval (ms) when waiting for the cloned iframe to become ready. */
|
|
18
18
|
export declare const IFRAME_READY_POLL_MS = 50;
|
|
19
|
+
/** Polling interval (ms) when waiting for clone stylesheets to apply. */
|
|
20
|
+
export declare const STYLESHEET_READY_POLL_MS = 50;
|
|
19
21
|
/**
|
|
20
22
|
* Total time (ms) to wait for the cloned iframe document to become ready
|
|
21
23
|
* after its load event. A missed deadline resolves with a warning (the
|
|
22
24
|
* capture continues with a possibly incomplete document).
|
|
23
25
|
*/
|
|
24
26
|
export declare const CLONE_READY_TIMEOUT_MS = 30000;
|
|
27
|
+
/**
|
|
28
|
+
* Total time (ms) to wait for the clone's external stylesheets (link and
|
|
29
|
+
* @import chains) to apply. Shorter than the document readiness window: a
|
|
30
|
+
* stylesheet that needs longer usually means a hung CDN, and rendering with
|
|
31
|
+
* a 10s-old layout beats blocking the capture for 30s. A missed deadline
|
|
32
|
+
* resolves with a warning (the capture continues with a possibly unstyled
|
|
33
|
+
* clone).
|
|
34
|
+
*/
|
|
35
|
+
export declare const STYLESHEET_READY_TIMEOUT_MS = 10000;
|
|
25
36
|
/**
|
|
26
37
|
* Hard ceiling (ms) for the cloned iframe's load event itself. If the event
|
|
27
38
|
* never fires, the mount is rejected instead of hanging forever.
|
|
@@ -40,6 +40,31 @@ type TrustedTypePolicyLike = {
|
|
|
40
40
|
*/
|
|
41
41
|
export declare const resolveTrustedTypesPolicy: (ownerWindow: Window | null) => TrustedTypePolicyLike | null;
|
|
42
42
|
export declare const createIFrameContainer: (ownerDocument: Document, bounds: Bounds, customContainer?: HTMLElement | ShadowRoot) => HTMLIFrameElement;
|
|
43
|
+
/**
|
|
44
|
+
* Wait until every external stylesheet of the clone has been applied or
|
|
45
|
+
* definitively failed, or the readiness budget expires.
|
|
46
|
+
*
|
|
47
|
+
* The clone is mounted by adoptNode() into an already-closed document
|
|
48
|
+
* (close() must precede adoptNode for Chrome uppercase class-name matching,
|
|
49
|
+
* see the mount sequence below), so the cloned <link rel="stylesheet">
|
|
50
|
+
* elements are inserted after the document finished loading: they neither
|
|
51
|
+
* delay the iframe load event nor change readyState, and the iframeLoader
|
|
52
|
+
* readiness poll cannot observe them. On a cold cache the first capture
|
|
53
|
+
* could then measure the clone before its external CSS arrived and render
|
|
54
|
+
* an unstyled layout (issue #245). Inline <style> clones apply
|
|
55
|
+
* synchronously and document-level adopted stylesheets are serialised at
|
|
56
|
+
* clone time, so neither needs this wait.
|
|
57
|
+
*
|
|
58
|
+
* Readiness is polled rather than purely event-driven because a <style>
|
|
59
|
+
* clone serialised from `createStyleClone` re-fetches its external @import
|
|
60
|
+
* rules without firing link load/error events, and shadow-root links are
|
|
61
|
+
* equally event-hostile in some engines. The poll covers both; link events
|
|
62
|
+
* remain as the settle path for plain <link> fetches.
|
|
63
|
+
* @internal – exported for testing only.
|
|
64
|
+
*/
|
|
65
|
+
export declare const stylesheetsReady: (documentClone: Document, logger?: {
|
|
66
|
+
warn: (msg: string) => void;
|
|
67
|
+
}, signal?: AbortSignal) => Promise<void>;
|
|
43
68
|
/**
|
|
44
69
|
* Serialise a document type declaration to an HTML string.
|
|
45
70
|
* @internal – exported for testing only, not part of the public API.
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"default": "./dist/html2canvas-pro.esm.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
"version": "2.5.
|
|
22
|
+
"version": "2.5.4",
|
|
23
23
|
"author": {
|
|
24
24
|
"name": "yorickshan",
|
|
25
25
|
"email": "yorickshan@gmail.com",
|
|
@@ -42,43 +42,43 @@
|
|
|
42
42
|
"@commitlint/cli": "^21.2.3",
|
|
43
43
|
"@commitlint/config-conventional": "^21.2.3",
|
|
44
44
|
"@types/express": "^5.0.6",
|
|
45
|
-
"@types/node": "^26.6.
|
|
45
|
+
"@types/node": "^26.6.5",
|
|
46
46
|
"@types/pngjs": "^6.0.5",
|
|
47
47
|
"@types/serve-index": "^1.9.4",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
49
|
-
"@typescript-eslint/parser": "^8.
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.71.2",
|
|
49
|
+
"@typescript-eslint/parser": "^8.71.2",
|
|
50
50
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
51
|
-
"@vitest/coverage-v8": "^5.0.
|
|
51
|
+
"@vitest/coverage-v8": "^5.0.4",
|
|
52
|
+
"axios": "^1.20.0",
|
|
52
53
|
"body-parser": "^2.3.0",
|
|
53
54
|
"conventional-changelog": "^8.1.3",
|
|
54
|
-
"conventional-changelog-conventionalcommits": "^10.4.
|
|
55
|
+
"conventional-changelog-conventionalcommits": "^10.4.1",
|
|
55
56
|
"cors": "^2.8.6",
|
|
56
|
-
"eslint": "^10.
|
|
57
|
+
"eslint": "^10.12.0",
|
|
57
58
|
"eslint-config-prettier": "^10.1.8",
|
|
58
59
|
"eslint-plugin-prettier": "^5.5.6",
|
|
59
|
-
"express": "^5.
|
|
60
|
-
"
|
|
60
|
+
"express": "^5.3.0",
|
|
61
|
+
"express-rate-limit": "^8.7.1",
|
|
61
62
|
"glob": "^13.0.6",
|
|
62
63
|
"husky": "^9.1.7",
|
|
63
|
-
"jsdom": "^30.1.
|
|
64
|
+
"jsdom": "^30.1.2",
|
|
64
65
|
"lint-staged": "^17.6.0",
|
|
65
|
-
"pixelmatch": "^
|
|
66
|
-
"playwright": "1.
|
|
66
|
+
"pixelmatch": "^8.0.0",
|
|
67
|
+
"playwright": "1.64.0",
|
|
67
68
|
"pngjs": "^7.0.0",
|
|
68
|
-
"prettier": "^3.9.
|
|
69
|
+
"prettier": "^3.9.10",
|
|
69
70
|
"rimraf": "^6.1.3",
|
|
70
|
-
"rolldown": "^1.2.
|
|
71
|
+
"rolldown": "^1.2.13",
|
|
71
72
|
"serve-index": "^1.9.2",
|
|
72
73
|
"slash": "5.1.0",
|
|
73
74
|
"tsx": "^4.23.15",
|
|
74
75
|
"typedoc": "^0.28.20",
|
|
75
76
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
76
|
-
"vite": "^8.3.
|
|
77
|
-
"vitepress": "^
|
|
78
|
-
"vitest": "^5.0.
|
|
77
|
+
"vite": "^8.3.4",
|
|
78
|
+
"vitepress": "^2.0.0-alpha.20",
|
|
79
|
+
"vitest": "^5.0.4",
|
|
79
80
|
"yargs": "^18.2.0"
|
|
80
81
|
},
|
|
81
|
-
"dependencies": {},
|
|
82
82
|
"lint-staged": {
|
|
83
83
|
"{src,tests}/**/*.ts": [
|
|
84
84
|
"prettier --write",
|
|
@@ -88,7 +88,6 @@
|
|
|
88
88
|
"scripts": {
|
|
89
89
|
"prebuild": "rimraf dist/ && rimraf build/ && mkdir -p dist && mkdir -p build",
|
|
90
90
|
"build": "tsc -p tsconfig.build.json && rolldown -c rolldown.config.ts && pnpm build:create-reftest-list && node scripts/bundle-filter-surface.mjs",
|
|
91
|
-
"build:testrunner": "rolldown -c tests/rolldown.testrunner.config.ts",
|
|
92
91
|
"build:reftest-result-list": "tsx scripts/create-reftest-result-list.ts",
|
|
93
92
|
"build:create-reftest-list": "tsx scripts/create-reftest-list.ts tests/reftests/ignore.txt build/reftests.js",
|
|
94
93
|
"release": "sh scripts/version-upgrade.sh",
|