@pixldocs/canvas-renderer 0.5.213 → 0.5.215
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/dist/{index-XZf4TDQ-.js → index-BV_MP9XQ.js} +102 -90
- package/dist/index-BV_MP9XQ.js.map +1 -0
- package/dist/{index-zkVpb-YL.cjs → index-CzwZcfGF.cjs} +102 -90
- package/dist/index-CzwZcfGF.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-ox1nl4G9.js → vectorPdfExport-CN1fcrfR.js} +8 -22
- package/dist/vectorPdfExport-CN1fcrfR.js.map +1 -0
- package/dist/{vectorPdfExport-krI8SwbX.cjs → vectorPdfExport-DUohXw5V.cjs} +8 -22
- package/dist/vectorPdfExport-DUohXw5V.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-XZf4TDQ-.js.map +0 -1
- package/dist/index-zkVpb-YL.cjs.map +0 -1
- package/dist/vectorPdfExport-krI8SwbX.cjs.map +0 -1
- package/dist/vectorPdfExport-ox1nl4G9.js.map +0 -1
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jspdf = require("jspdf");
|
|
4
4
|
const svg2pdf_js = require("svg2pdf.js");
|
|
5
5
|
const fabric = require("fabric");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-CzwZcfGF.cjs");
|
|
7
7
|
const pdfFonts = require("./pdfFonts-BTj2f465.cjs");
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -169,7 +169,7 @@ async function ensureImageDecoded(img) {
|
|
|
169
169
|
} catch {
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
const SHADOW_RASTER_ALPHA_COMPENSATION =
|
|
172
|
+
const SHADOW_RASTER_ALPHA_COMPENSATION = 1;
|
|
173
173
|
function collectFontSpecsFromShadowMarkup(markup) {
|
|
174
174
|
const specs = /* @__PURE__ */ new Set();
|
|
175
175
|
const re = /<(?:text|tspan)\b[^>]*>/gi;
|
|
@@ -2079,7 +2079,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
|
|
|
2079
2079
|
}
|
|
2080
2080
|
}
|
|
2081
2081
|
async function rasterizeShadowMarkers(svg) {
|
|
2082
|
-
var _a, _b, _c, _d, _e, _f
|
|
2082
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2083
2083
|
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
2084
2084
|
const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
|
|
2085
2085
|
if (markers.length === 0) return;
|
|
@@ -2134,29 +2134,15 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
2134
2134
|
img.setAttribute("y", String(by));
|
|
2135
2135
|
img.setAttribute("width", String(bw));
|
|
2136
2136
|
img.setAttribute("height", String(bh));
|
|
2137
|
-
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
|
|
2138
2137
|
img.setAttribute("preserveAspectRatio", "none");
|
|
2139
2138
|
img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
|
|
2140
2139
|
img.setAttribute("href", dataUrl);
|
|
2141
|
-
|
|
2142
|
-
const lastAlphaRaw = parseFloat(marker.getAttribute("data-last-alpha") || "1");
|
|
2143
|
-
const lastAlpha = Number.isFinite(lastAlphaRaw) ? Math.max(0, Math.min(1, lastAlphaRaw)) : 1;
|
|
2144
|
-
const baseOpacity = Number(img.getAttribute("opacity") || "1") || 1;
|
|
2140
|
+
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
|
|
2145
2141
|
(_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
|
|
2146
|
-
for (let i = 1; i < passes; i++) {
|
|
2147
|
-
const extra = img.cloneNode(true);
|
|
2148
|
-
if (i === passes - 1 && lastAlpha < 1) {
|
|
2149
|
-
extra.setAttribute("opacity", String(baseOpacity * lastAlpha));
|
|
2150
|
-
}
|
|
2151
|
-
(_f = img.parentNode) == null ? void 0 : _f.insertBefore(extra, img.nextSibling);
|
|
2152
|
-
}
|
|
2153
|
-
if (passes === 1 && lastAlpha < 1) {
|
|
2154
|
-
img.setAttribute("opacity", String(baseOpacity * lastAlpha));
|
|
2155
|
-
}
|
|
2156
2142
|
} catch (error) {
|
|
2157
2143
|
console.warn("[Vector PDF] text shadow rasterization failed for one marker:", error);
|
|
2158
2144
|
try {
|
|
2159
|
-
(
|
|
2145
|
+
(_f = marker.parentNode) == null ? void 0 : _f.removeChild(marker);
|
|
2160
2146
|
} catch {
|
|
2161
2147
|
}
|
|
2162
2148
|
}
|
|
@@ -2984,7 +2970,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2984
2970
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2985
2971
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2986
2972
|
try {
|
|
2987
|
-
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-
|
|
2973
|
+
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-CzwZcfGF.cjs")).then((n) => n.canvasImageLoader);
|
|
2988
2974
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2989
2975
|
} catch {
|
|
2990
2976
|
return null;
|
|
@@ -3793,7 +3779,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3793
3779
|
}
|
|
3794
3780
|
let fetchUrl = imageUrl;
|
|
3795
3781
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3796
|
-
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-
|
|
3782
|
+
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-CzwZcfGF.cjs")).then((n) => n.canvasImageLoader);
|
|
3797
3783
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3798
3784
|
const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
|
|
3799
3785
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5892,4 +5878,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
|
|
|
5892
5878
|
exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
|
|
5893
5879
|
exports.preparePagesForExport = preparePagesForExport;
|
|
5894
5880
|
exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
|
|
5895
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5881
|
+
//# sourceMappingURL=vectorPdfExport-DUohXw5V.cjs.map
|