html2canvas-pro 2.3.3 → 2.3.5
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 +6 -2
- package/dist/html2canvas-pro.cjs +30 -17
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +30 -17
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +30 -17
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +3 -3
- package/dist/lib/css/index.js +8 -1
- package/dist/lib/css/syntax/parser.js +5 -4
- package/dist/lib/dom/node-parser.js +42 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,14 +22,18 @@ Next generation JavaScript screenshot tool.
|
|
|
22
22
|
## Why html2canvas-pro?
|
|
23
23
|
|
|
24
24
|
html2canvas-pro is a fork of [niklasvh/html2canvas](https://github.com/niklasvh/html2canvas) that includes various fixes and new features. It offers several advantages over the original html2canvas:
|
|
25
|
-
- Color
|
|
26
|
-
-
|
|
25
|
+
- Color functions `color()` (incl. relative colors), `lab()`, `lch()`, `oklab()`, `oklch()`
|
|
26
|
+
- `background-clip: text` support
|
|
27
|
+
- `mix-blend-mode` support
|
|
27
28
|
- `object-fit` support for `<img/>`
|
|
28
29
|
- CSS `clip-path` support (inset, circle, ellipse, polygon, path)
|
|
29
30
|
- CSS `writing-mode` support (horizontal-tb, vertical-rl, vertical-lr)
|
|
31
|
+
- Native `drop-shadow()` filter rendering via the canvas shadow API
|
|
30
32
|
- **Image smoothing control** — CSS `image-rendering` property and `imageSmoothing`/`imageSmoothingQuality` options
|
|
31
33
|
- **Security validation** — Built-in input validation (XSS/SSRF protection)
|
|
32
34
|
- **Performance monitoring** — Built-in performance measurement API
|
|
35
|
+
- **Progress & error callbacks** — `onProgress` / `onError` options and `AbortSignal` cancellation
|
|
36
|
+
- **Performance optimizations** — deferred CSS parsing and LRU caches for gradients & CSS parsing
|
|
33
37
|
- Various bug fixes from the [changelog](./CHANGELOG.md)
|
|
34
38
|
|
|
35
39
|
If you found this helpful, don't forget to
|
package/dist/html2canvas-pro.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* html2canvas-pro 2.3.
|
|
2
|
+
* html2canvas-pro 2.3.5 <https://yorickshan.github.io/html2canvas-pro/>
|
|
3
3
|
* Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
|
|
4
4
|
* Released under MIT License
|
|
5
5
|
*/
|
|
@@ -1731,9 +1731,10 @@ const parseFunctionArgs = (tokens) => {
|
|
|
1731
1731
|
let arg = [];
|
|
1732
1732
|
tokens.forEach((token) => {
|
|
1733
1733
|
if (token.type === 4) {
|
|
1734
|
-
if (arg.length
|
|
1735
|
-
|
|
1736
|
-
|
|
1734
|
+
if (arg.length) {
|
|
1735
|
+
args.push(arg);
|
|
1736
|
+
arg = [];
|
|
1737
|
+
}
|
|
1737
1738
|
return;
|
|
1738
1739
|
}
|
|
1739
1740
|
if (token.type !== 31) arg.push(token);
|
|
@@ -6732,7 +6733,8 @@ var CSSParsedCounterDeclaration = class {
|
|
|
6732
6733
|
};
|
|
6733
6734
|
const parseCache = /* @__PURE__ */ new Map();
|
|
6734
6735
|
const parse = (context, descriptor, style) => {
|
|
6735
|
-
|
|
6736
|
+
let rawValue = style !== null && typeof style !== "undefined" ? style.toString() : descriptor.initialValue;
|
|
6737
|
+
if (rawValue.trim() === "") rawValue = descriptor.initialValue;
|
|
6736
6738
|
let valueCache = parseCache.get(descriptor);
|
|
6737
6739
|
if (valueCache) {
|
|
6738
6740
|
const cached = valueCache.get(rawValue);
|
|
@@ -8181,18 +8183,29 @@ const LIST_OWNERS = [
|
|
|
8181
8183
|
const parseNodeTree = (context, node, parent, root) => {
|
|
8182
8184
|
for (let childNode = node.firstChild, nextNode; childNode; childNode = nextNode) {
|
|
8183
8185
|
nextNode = childNode.nextSibling;
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8186
|
+
parseChildNode(context, childNode, parent, root);
|
|
8187
|
+
}
|
|
8188
|
+
};
|
|
8189
|
+
/**
|
|
8190
|
+
* Parse a single node as a child of `parent`.
|
|
8191
|
+
*
|
|
8192
|
+
* Separated from the tree walk so that nodes assigned to a `<slot>` (including
|
|
8193
|
+
* bare text nodes, which have no child nodes) can be parsed directly. Without
|
|
8194
|
+
* this, slotted shadow-DOM content such as web component labels was silently
|
|
8195
|
+
* dropped because `parseNodeTree` only iterates `node.firstChild` (issue #226).
|
|
8196
|
+
*/
|
|
8197
|
+
const parseChildNode = (context, childNode, parent, root) => {
|
|
8198
|
+
if (isTextNode(childNode) && childNode.data.length > 0) parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
|
|
8199
|
+
else if (isElementNode(childNode)) if (isSlotElement(childNode) && childNode.assignedNodes) childNode.assignedNodes().forEach((assignedNode) => parseChildNode(context, assignedNode, parent, root));
|
|
8200
|
+
else {
|
|
8201
|
+
const container = createContainer(context, childNode);
|
|
8202
|
+
if (container.styles.isVisible()) {
|
|
8203
|
+
if (createsRealStackingContext(childNode, container, root)) container.createsRealStackingContext = true;
|
|
8204
|
+
else if (createsStackingContext(container.styles)) container.createsStackingContext = true;
|
|
8205
|
+
if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) container.isListOwner = true;
|
|
8206
|
+
parent.elements.push(container);
|
|
8207
|
+
if (childNode.shadowRoot) parseNodeTree(context, childNode.shadowRoot, container, root);
|
|
8208
|
+
else if (!isTextareaElement(childNode) && !isSVGElement(childNode) && !isSelectElement(childNode)) parseNodeTree(context, childNode, container, root);
|
|
8196
8209
|
}
|
|
8197
8210
|
}
|
|
8198
8211
|
};
|