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
  */
@@ -8442,9 +8442,18 @@ var BlendEffect = class {
8442
8442
  };
8443
8443
  var FilterEffect = class {
8444
8444
  constructor(filterString) {
8445
- this.filterString = filterString;
8446
8445
  this.type = 5;
8447
8446
  this.target = 6;
8447
+ const dropShadowMatch = filterString.match(/drop-shadow\(\s*([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+(.+?)\s*\)/);
8448
+ if (dropShadowMatch) {
8449
+ this.shadow = {
8450
+ offsetX: parseFloat(dropShadowMatch[1]),
8451
+ offsetY: parseFloat(dropShadowMatch[3]),
8452
+ blur: parseFloat(dropShadowMatch[5]),
8453
+ color: dropShadowMatch[7].trim()
8454
+ };
8455
+ this.safeFilterString = filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
8456
+ } else this.safeFilterString = filterString;
8448
8457
  }
8449
8458
  };
8450
8459
  const isTransformEffect = (effect) => effect.type === 0;
@@ -9900,8 +9909,13 @@ var EffectsRenderer = class {
9900
9909
  } else if (isClipPathEffect(effect)) effect.applyClip(this.ctx);
9901
9910
  else if (isBlendEffect(effect)) this.ctx.globalCompositeOperation = effect.compositeOperation;
9902
9911
  else if (isFilterEffect(effect)) {
9903
- const safe = effect.filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
9904
- this.ctx.filter = safe || "none";
9912
+ this.ctx.filter = effect.safeFilterString || "none";
9913
+ if (effect.shadow) {
9914
+ this.ctx.shadowOffsetX = effect.shadow.offsetX;
9915
+ this.ctx.shadowOffsetY = effect.shadow.offsetY;
9916
+ this.ctx.shadowBlur = effect.shadow.blur;
9917
+ this.ctx.shadowColor = effect.shadow.color;
9918
+ }
9905
9919
  }
9906
9920
  this.activeEffects.push(effect);
9907
9921
  }