html2canvas-pro 2.2.1 → 2.2.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 2.2.1 <https://yorickshan.github.io/html2canvas-pro/>
2
+ * html2canvas-pro 2.2.2 <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
  */
@@ -8449,9 +8449,18 @@
8449
8449
  };
8450
8450
  var FilterEffect = class {
8451
8451
  constructor(filterString) {
8452
- this.filterString = filterString;
8453
8452
  this.type = 5;
8454
8453
  this.target = 6;
8454
+ const dropShadowMatch = filterString.match(/drop-shadow\(\s*([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+(.+?)\s*\)/);
8455
+ if (dropShadowMatch) {
8456
+ this.shadow = {
8457
+ offsetX: parseFloat(dropShadowMatch[1]),
8458
+ offsetY: parseFloat(dropShadowMatch[3]),
8459
+ blur: parseFloat(dropShadowMatch[5]),
8460
+ color: dropShadowMatch[7].trim()
8461
+ };
8462
+ this.safeFilterString = filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
8463
+ } else this.safeFilterString = filterString;
8455
8464
  }
8456
8465
  };
8457
8466
  const isTransformEffect = (effect) => effect.type === 0;
@@ -9907,8 +9916,13 @@
9907
9916
  } else if (isClipPathEffect(effect)) effect.applyClip(this.ctx);
9908
9917
  else if (isBlendEffect(effect)) this.ctx.globalCompositeOperation = effect.compositeOperation;
9909
9918
  else if (isFilterEffect(effect)) {
9910
- const safe = effect.filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
9911
- this.ctx.filter = safe || "none";
9919
+ this.ctx.filter = effect.safeFilterString || "none";
9920
+ if (effect.shadow) {
9921
+ this.ctx.shadowOffsetX = effect.shadow.offsetX;
9922
+ this.ctx.shadowOffsetY = effect.shadow.offsetY;
9923
+ this.ctx.shadowBlur = effect.shadow.blur;
9924
+ this.ctx.shadowColor = effect.shadow.color;
9925
+ }
9912
9926
  }
9913
9927
  this.activeEffects.push(effect);
9914
9928
  }