@pixldocs/canvas-renderer 0.5.211 → 0.5.213
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-C0tTvSFQ.js → index-XZf4TDQ-.js} +133 -14
- package/dist/index-XZf4TDQ-.js.map +1 -0
- package/dist/{index-d8U2oDzI.cjs → index-zkVpb-YL.cjs} +133 -14
- package/dist/index-zkVpb-YL.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-QzySzFJJ.cjs → vectorPdfExport-krI8SwbX.cjs} +20 -6
- package/dist/vectorPdfExport-krI8SwbX.cjs.map +1 -0
- package/dist/{vectorPdfExport-BEGl71uB.js → vectorPdfExport-ox1nl4G9.js} +20 -6
- package/dist/vectorPdfExport-ox1nl4G9.js.map +1 -0
- package/package.json +1 -1
- package/dist/index-C0tTvSFQ.js.map +0 -1
- package/dist/index-d8U2oDzI.cjs.map +0 -1
- package/dist/vectorPdfExport-BEGl71uB.js.map +0 -1
- package/dist/vectorPdfExport-QzySzFJJ.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsPDF, ShadingPattern } from "jspdf";
|
|
2
2
|
import { svg2pdf } from "svg2pdf.js";
|
|
3
3
|
import * as fabric from "fabric";
|
|
4
|
-
import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-
|
|
4
|
+
import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-XZf4TDQ-.js";
|
|
5
5
|
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-DhEaMTZl.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
@@ -2060,7 +2060,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
|
|
|
2060
2060
|
}
|
|
2061
2061
|
}
|
|
2062
2062
|
async function rasterizeShadowMarkers(svg) {
|
|
2063
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2063
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2064
2064
|
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
2065
2065
|
const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
|
|
2066
2066
|
if (markers.length === 0) return;
|
|
@@ -2119,11 +2119,25 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
2119
2119
|
img.setAttribute("preserveAspectRatio", "none");
|
|
2120
2120
|
img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
|
|
2121
2121
|
img.setAttribute("href", dataUrl);
|
|
2122
|
+
const passes = Math.max(1, Math.min(8, parseInt(marker.getAttribute("data-passes") || "1", 10) || 1));
|
|
2123
|
+
const lastAlphaRaw = parseFloat(marker.getAttribute("data-last-alpha") || "1");
|
|
2124
|
+
const lastAlpha = Number.isFinite(lastAlphaRaw) ? Math.max(0, Math.min(1, lastAlphaRaw)) : 1;
|
|
2125
|
+
const baseOpacity = Number(img.getAttribute("opacity") || "1") || 1;
|
|
2122
2126
|
(_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
|
|
2127
|
+
for (let i = 1; i < passes; i++) {
|
|
2128
|
+
const extra = img.cloneNode(true);
|
|
2129
|
+
if (i === passes - 1 && lastAlpha < 1) {
|
|
2130
|
+
extra.setAttribute("opacity", String(baseOpacity * lastAlpha));
|
|
2131
|
+
}
|
|
2132
|
+
(_f = img.parentNode) == null ? void 0 : _f.insertBefore(extra, img.nextSibling);
|
|
2133
|
+
}
|
|
2134
|
+
if (passes === 1 && lastAlpha < 1) {
|
|
2135
|
+
img.setAttribute("opacity", String(baseOpacity * lastAlpha));
|
|
2136
|
+
}
|
|
2123
2137
|
} catch (error) {
|
|
2124
2138
|
console.warn("[Vector PDF] text shadow rasterization failed for one marker:", error);
|
|
2125
2139
|
try {
|
|
2126
|
-
(
|
|
2140
|
+
(_g = marker.parentNode) == null ? void 0 : _g.removeChild(marker);
|
|
2127
2141
|
} catch {
|
|
2128
2142
|
}
|
|
2129
2143
|
}
|
|
@@ -2951,7 +2965,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2951
2965
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2952
2966
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2953
2967
|
try {
|
|
2954
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2968
|
+
const { getNormalizedSvgUrl } = await import("./index-XZf4TDQ-.js").then((n) => n.a6);
|
|
2955
2969
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2956
2970
|
} catch {
|
|
2957
2971
|
return null;
|
|
@@ -3760,7 +3774,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3760
3774
|
}
|
|
3761
3775
|
let fetchUrl = imageUrl;
|
|
3762
3776
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3763
|
-
const { isPrivateUrl } = await import("./index-
|
|
3777
|
+
const { isPrivateUrl } = await import("./index-XZf4TDQ-.js").then((n) => n.a6);
|
|
3764
3778
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3765
3779
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3766
3780
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5861,4 +5875,4 @@ export {
|
|
|
5861
5875
|
preparePagesForExport,
|
|
5862
5876
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5863
5877
|
};
|
|
5864
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5878
|
+
//# sourceMappingURL=vectorPdfExport-ox1nl4G9.js.map
|