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
  */
@@ -3896,6 +3896,7 @@ const backgroundImage = {
3896
3896
  initialValue: "none",
3897
3897
  type: 1,
3898
3898
  prefix: false,
3899
+ skipCache: true,
3899
3900
  parse: (context, tokens) => {
3900
3901
  if (tokens.length === 0) return [];
3901
3902
  const first = tokens[0];
@@ -4338,6 +4339,7 @@ const listStyleImage = {
4338
4339
  initialValue: "none",
4339
4340
  type: 0,
4340
4341
  prefix: false,
4342
+ skipCache: true,
4341
4343
  parse: (context, token) => {
4342
4344
  if (token.type === 20 && token.value === "none") return null;
4343
4345
  return image.parse(context, token);
@@ -5358,6 +5360,7 @@ const borderImageSource = {
5358
5360
  initialValue: "none",
5359
5361
  prefix: false,
5360
5362
  type: 1,
5363
+ skipCache: true,
5361
5364
  parse: (context, tokens) => {
5362
5365
  if (tokens.length === 0) return null;
5363
5366
  const filtered = tokens.filter((t) => nonFunctionArgSeparator(t) && isSupportedImage(t));
@@ -6294,7 +6297,7 @@ const parse = (context, descriptor, style) => {
6294
6297
  valueCache = /* @__PURE__ */ new Map();
6295
6298
  parseCache.set(descriptor, valueCache);
6296
6299
  }
6297
- if (!(descriptor.type === 3 && descriptor.format === "image")) {
6300
+ if (!(descriptor.skipCache || descriptor.type === 3 && descriptor.format === "image")) {
6298
6301
  if (valueCache.size >= 200) {
6299
6302
  const oldestKey = valueCache.keys().next().value;
6300
6303
  valueCache.delete(oldestKey);
@@ -8442,9 +8445,18 @@ var BlendEffect = class {
8442
8445
  };
8443
8446
  var FilterEffect = class {
8444
8447
  constructor(filterString) {
8445
- this.filterString = filterString;
8446
8448
  this.type = 5;
8447
8449
  this.target = 6;
8450
+ const dropShadowMatch = filterString.match(/drop-shadow\(\s*([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+([\d.-]+)(px)?\s+(.+?)\s*\)/);
8451
+ if (dropShadowMatch) {
8452
+ this.shadow = {
8453
+ offsetX: parseFloat(dropShadowMatch[1]),
8454
+ offsetY: parseFloat(dropShadowMatch[3]),
8455
+ blur: parseFloat(dropShadowMatch[5]),
8456
+ color: dropShadowMatch[7].trim()
8457
+ };
8458
+ this.safeFilterString = filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
8459
+ } else this.safeFilterString = filterString;
8448
8460
  }
8449
8461
  };
8450
8462
  const isTransformEffect = (effect) => effect.type === 0;
@@ -9900,8 +9912,13 @@ var EffectsRenderer = class {
9900
9912
  } else if (isClipPathEffect(effect)) effect.applyClip(this.ctx);
9901
9913
  else if (isBlendEffect(effect)) this.ctx.globalCompositeOperation = effect.compositeOperation;
9902
9914
  else if (isFilterEffect(effect)) {
9903
- const safe = effect.filterString.replace(/drop-shadow\([^)]+\)\s*/g, "").trim();
9904
- this.ctx.filter = safe || "none";
9915
+ this.ctx.filter = effect.safeFilterString || "none";
9916
+ if (effect.shadow) {
9917
+ this.ctx.shadowOffsetX = effect.shadow.offsetX;
9918
+ this.ctx.shadowOffsetY = effect.shadow.offsetY;
9919
+ this.ctx.shadowBlur = effect.shadow.blur;
9920
+ this.ctx.shadowColor = effect.shadow.color;
9921
+ }
9905
9922
  }
9906
9923
  this.activeEffects.push(effect);
9907
9924
  }