html2canvas-pro 2.2.1 → 2.2.3

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.3 <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
  */
@@ -3903,6 +3903,7 @@
3903
3903
  initialValue: "none",
3904
3904
  type: 1,
3905
3905
  prefix: false,
3906
+ skipCache: true,
3906
3907
  parse: (context, tokens) => {
3907
3908
  if (tokens.length === 0) return [];
3908
3909
  const first = tokens[0];
@@ -4345,6 +4346,7 @@
4345
4346
  initialValue: "none",
4346
4347
  type: 0,
4347
4348
  prefix: false,
4349
+ skipCache: true,
4348
4350
  parse: (context, token) => {
4349
4351
  if (token.type === 20 && token.value === "none") return null;
4350
4352
  return image.parse(context, token);
@@ -5365,6 +5367,7 @@
5365
5367
  initialValue: "none",
5366
5368
  prefix: false,
5367
5369
  type: 1,
5370
+ skipCache: true,
5368
5371
  parse: (context, tokens) => {
5369
5372
  if (tokens.length === 0) return null;
5370
5373
  const filtered = tokens.filter((t) => nonFunctionArgSeparator(t) && isSupportedImage(t));
@@ -6301,7 +6304,7 @@
6301
6304
  valueCache = /* @__PURE__ */ new Map();
6302
6305
  parseCache.set(descriptor, valueCache);
6303
6306
  }
6304
- if (!(descriptor.type === 3 && descriptor.format === "image")) {
6307
+ if (!(descriptor.skipCache || descriptor.type === 3 && descriptor.format === "image")) {
6305
6308
  if (valueCache.size >= 200) {
6306
6309
  const oldestKey = valueCache.keys().next().value;
6307
6310
  valueCache.delete(oldestKey);
@@ -8449,9 +8452,18 @@
8449
8452
  };
8450
8453
  var FilterEffect = class {
8451
8454
  constructor(filterString) {
8452
- this.filterString = filterString;
8453
8455
  this.type = 5;
8454
8456
  this.target = 6;
8457
+ const dropShadowMatch = filterString.match(/drop-shadow\(\s*([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+(.+?)\s*\)/);
8458
+ if (dropShadowMatch) {
8459
+ this.shadow = {
8460
+ offsetX: parseFloat(dropShadowMatch[1]),
8461
+ offsetY: parseFloat(dropShadowMatch[3]),
8462
+ blur: parseFloat(dropShadowMatch[5]),
8463
+ color: dropShadowMatch[7].trim()
8464
+ };
8465
+ this.safeFilterString = filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
8466
+ } else this.safeFilterString = filterString;
8455
8467
  }
8456
8468
  };
8457
8469
  const isTransformEffect = (effect) => effect.type === 0;
@@ -9907,8 +9919,13 @@
9907
9919
  } else if (isClipPathEffect(effect)) effect.applyClip(this.ctx);
9908
9920
  else if (isBlendEffect(effect)) this.ctx.globalCompositeOperation = effect.compositeOperation;
9909
9921
  else if (isFilterEffect(effect)) {
9910
- const safe = effect.filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
9911
- this.ctx.filter = safe || "none";
9922
+ this.ctx.filter = effect.safeFilterString || "none";
9923
+ if (effect.shadow) {
9924
+ this.ctx.shadowOffsetX = effect.shadow.offsetX;
9925
+ this.ctx.shadowOffsetY = effect.shadow.offsetY;
9926
+ this.ctx.shadowBlur = effect.shadow.blur;
9927
+ this.ctx.shadowColor = effect.shadow.color;
9928
+ }
9912
9929
  }
9913
9930
  this.activeEffects.push(effect);
9914
9931
  }