html2canvas-pro 2.2.0 → 2.2.1

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
@@ -5,32 +5,32 @@
5
5
  html2canvas-pro
6
6
  </h1>
7
7
  <p align="center">
8
- Next generation JavaScript screenshots tool.
9
- <p>
8
+ Next generation JavaScript screenshot tool.
9
+ </p>
10
10
  <p align="center">
11
11
  <a href="https://github.com/yorickshan/html2canvas-pro/actions/workflows/ci.yml"><img src="https://github.com/yorickshan/html2canvas-pro/actions/workflows/ci.yml/badge.svg?branch=main" alt="build status"></a>
12
- <a href=https://npm.im/html2canvas-pro><img src="https://badgen.net/npm/v/html2canvas-pro" alt="npm version"></a>
13
- <a href=http://npm.im/html2canvas-pro><img src="https://badgen.net/npm/dm/html2canvas-pro" alt="npm downloads"></a>
12
+ <a href="https://npm.im/html2canvas-pro"><img src="https://badgen.net/npm/v/html2canvas-pro" alt="npm version"></a>
13
+ <a href="http://npm.im/html2canvas-pro"><img src="https://badgen.net/npm/dm/html2canvas-pro" alt="npm downloads"></a>
14
14
  <a href="https://www.jsdelivr.com/package/npm/html2canvas-pro"><img src="https://data.jsdelivr.com/v1/package/npm/html2canvas-pro/badge" /></a>
15
- <p>
15
+ <a href="https://deepwiki.com/yorickshan/html2canvas-pro"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
16
+ </p>
16
17
  <p align="center">
17
18
  <a href="https://yorickshan.github.io/html2canvas-pro/getting-started.html">Getting Started</a>
18
- | <a href="https://deepwiki.com/yorickshan/html2canvas-pro">DeepWiki</a>
19
19
  </p>
20
20
  <br>
21
21
 
22
22
  ## Why html2canvas-pro?
23
23
 
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, such as:
25
- - support color function ```color()``` (including relative colors)
26
- - support color function ```lab()``` / ```lch()``` / ```oklab()``` / ```oklch()```
27
- - Support object-fit of ```<img/>```
28
- - Support CSS ```clip-path``` (inset, circle, ellipse, polygon, path)
29
- - Support CSS ```writing-mode``` (horizontal-tb, vertical-rl, vertical-lr)
30
- - **Image smoothing control** - Support CSS `image-rendering` property and `imageSmoothing`/`imageSmoothingQuality` options
31
- - **Security validation** - Built-in input validation (XSS/SSRF protection)
32
- - **Performance monitoring** - Built-in performance measurement API
33
- - Fixed some [issues](./CHANGELOG.md)
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()`
27
+ - `object-fit` support for `<img/>`
28
+ - CSS `clip-path` support (inset, circle, ellipse, polygon, path)
29
+ - CSS `writing-mode` support (horizontal-tb, vertical-rl, vertical-lr)
30
+ - **Image smoothing control** CSS `image-rendering` property and `imageSmoothing`/`imageSmoothingQuality` options
31
+ - **Security validation** Built-in input validation (XSS/SSRF protection)
32
+ - **Performance monitoring** Built-in performance measurement API
33
+ - Various bug fixes from the [changelog](./CHANGELOG.md)
34
34
 
35
35
  If you found this helpful, don't forget to
36
36
  leave a star 🌟.
@@ -78,10 +78,10 @@ See the [Configuration Guide](/docs/configuration.md#canvas-dimensions) for more
78
78
 
79
79
  ## Contribution
80
80
 
81
- If you want to add some features, feel free to submit PR.
81
+ If you'd like to add a feature, feel free to submit a PR.
82
82
 
83
- If you want to become a maintainer on it, please contact me.
83
+ Interested in becoming a maintainer? Open an [issue](https://github.com/yorickshan/html2canvas-pro/issues) or reach out to [@yorickshan](https://github.com/yorickshan).
84
84
 
85
85
  ## License
86
86
 
87
- [MIT](LICENSE).
87
+ [MIT](LICENSE)
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 2.2.0 <https://yorickshan.github.io/html2canvas-pro/>
2
+ * html2canvas-pro 2.2.1 <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
  */
@@ -6294,11 +6294,13 @@ const parse = (context, descriptor, style) => {
6294
6294
  valueCache = /* @__PURE__ */ new Map();
6295
6295
  parseCache.set(descriptor, valueCache);
6296
6296
  }
6297
- if (valueCache.size >= 200) {
6298
- const oldestKey = valueCache.keys().next().value;
6299
- valueCache.delete(oldestKey);
6297
+ if (!(descriptor.type === 3 && descriptor.format === "image")) {
6298
+ if (valueCache.size >= 200) {
6299
+ const oldestKey = valueCache.keys().next().value;
6300
+ valueCache.delete(oldestKey);
6301
+ }
6302
+ valueCache.set(rawValue, result);
6300
6303
  }
6301
- valueCache.set(rawValue, result);
6302
6304
  return result;
6303
6305
  };
6304
6306
  //#endregion
@@ -9897,7 +9899,10 @@ var EffectsRenderer = class {
9897
9899
  this.ctx.clip();
9898
9900
  } else if (isClipPathEffect(effect)) effect.applyClip(this.ctx);
9899
9901
  else if (isBlendEffect(effect)) this.ctx.globalCompositeOperation = effect.compositeOperation;
9900
- else if (isFilterEffect(effect)) this.ctx.filter = effect.filterString;
9902
+ else if (isFilterEffect(effect)) {
9903
+ const safe = effect.filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
9904
+ this.ctx.filter = safe || "none";
9905
+ }
9901
9906
  this.activeEffects.push(effect);
9902
9907
  }
9903
9908
  /**
@@ -10714,7 +10719,8 @@ const renderElement = async (element, opts, config) => {
10714
10719
  imageTimeout: opts.imageTimeout ?? 15e3,
10715
10720
  proxy: opts.proxy,
10716
10721
  useCORS: opts.useCORS ?? false,
10717
- customIsSameOrigin: opts.customIsSameOrigin
10722
+ customIsSameOrigin: opts.customIsSameOrigin,
10723
+ maxCacheSize: opts.maxCacheSize
10718
10724
  };
10719
10725
  const contextOptions = {
10720
10726
  logging: opts.logging ?? true,