html2canvas-pro 2.2.0 → 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.
- package/README.md +19 -19
- package/dist/html2canvas-pro.esm.js +28 -8
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +28 -8
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +3 -3
- package/dist/lib/core/render-element.js +2 -1
- package/dist/lib/css/index.js +10 -4
- package/dist/lib/render/canvas/effects-renderer.js +11 -1
- package/dist/lib/render/effects.js +15 -1
- package/dist/types/render/effects.d.ts +9 -1
- package/package.json +1 -1
package/dist/html2canvas-pro.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* html2canvas-pro 2.2.
|
|
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
|
*/
|
|
@@ -6301,11 +6301,13 @@
|
|
|
6301
6301
|
valueCache = /* @__PURE__ */ new Map();
|
|
6302
6302
|
parseCache.set(descriptor, valueCache);
|
|
6303
6303
|
}
|
|
6304
|
-
if (
|
|
6305
|
-
|
|
6306
|
-
|
|
6304
|
+
if (!(descriptor.type === 3 && descriptor.format === "image")) {
|
|
6305
|
+
if (valueCache.size >= 200) {
|
|
6306
|
+
const oldestKey = valueCache.keys().next().value;
|
|
6307
|
+
valueCache.delete(oldestKey);
|
|
6308
|
+
}
|
|
6309
|
+
valueCache.set(rawValue, result);
|
|
6307
6310
|
}
|
|
6308
|
-
valueCache.set(rawValue, result);
|
|
6309
6311
|
return result;
|
|
6310
6312
|
};
|
|
6311
6313
|
//#endregion
|
|
@@ -8447,9 +8449,18 @@
|
|
|
8447
8449
|
};
|
|
8448
8450
|
var FilterEffect = class {
|
|
8449
8451
|
constructor(filterString) {
|
|
8450
|
-
this.filterString = filterString;
|
|
8451
8452
|
this.type = 5;
|
|
8452
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;
|
|
8453
8464
|
}
|
|
8454
8465
|
};
|
|
8455
8466
|
const isTransformEffect = (effect) => effect.type === 0;
|
|
@@ -9904,7 +9915,15 @@
|
|
|
9904
9915
|
this.ctx.clip();
|
|
9905
9916
|
} else if (isClipPathEffect(effect)) effect.applyClip(this.ctx);
|
|
9906
9917
|
else if (isBlendEffect(effect)) this.ctx.globalCompositeOperation = effect.compositeOperation;
|
|
9907
|
-
else if (isFilterEffect(effect))
|
|
9918
|
+
else if (isFilterEffect(effect)) {
|
|
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
|
+
}
|
|
9926
|
+
}
|
|
9908
9927
|
this.activeEffects.push(effect);
|
|
9909
9928
|
}
|
|
9910
9929
|
/**
|
|
@@ -10721,7 +10740,8 @@
|
|
|
10721
10740
|
imageTimeout: opts.imageTimeout ?? 15e3,
|
|
10722
10741
|
proxy: opts.proxy,
|
|
10723
10742
|
useCORS: opts.useCORS ?? false,
|
|
10724
|
-
customIsSameOrigin: opts.customIsSameOrigin
|
|
10743
|
+
customIsSameOrigin: opts.customIsSameOrigin,
|
|
10744
|
+
maxCacheSize: opts.maxCacheSize
|
|
10725
10745
|
};
|
|
10726
10746
|
const contextOptions = {
|
|
10727
10747
|
logging: opts.logging ?? true,
|