html2canvas-pro 2.3.3 → 2.3.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 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 function `color()` (including relative colors)
26
- - Color functions `lab()` / `lch()` / `oklab()` / `oklch()`
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 2.3.3 <https://yorickshan.github.io/html2canvas-pro/>
2
+ * html2canvas-pro 2.3.4 <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 === 0) throw new Error(`Error parsing function args, zero tokens for arg`);
1735
- args.push(arg);
1736
- arg = [];
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
- const rawValue = style !== null && typeof style !== "undefined" ? style.toString() : descriptor.initialValue;
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);