@pixldocs/canvas-renderer 0.5.213 → 0.5.214
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-CDdfs3IB.js} +30 -83
- package/dist/index-CDdfs3IB.js.map +1 -0
- package/dist/{index-zkVpb-YL.cjs → index-Cy2_ElDZ.cjs} +30 -83
- package/dist/index-Cy2_ElDZ.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-krI8SwbX.cjs → vectorPdfExport-BBG0QRse.cjs} +9 -21
- package/dist/vectorPdfExport-BBG0QRse.cjs.map +1 -0
- package/dist/{vectorPdfExport-ox1nl4G9.js → vectorPdfExport-CjIUU8on.js} +9 -21
- package/dist/vectorPdfExport-CjIUU8on.js.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
|
@@ -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-CDdfs3IB.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;
|
|
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;
|
|
@@ -2115,29 +2115,17 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
2115
2115
|
img.setAttribute("y", String(by));
|
|
2116
2116
|
img.setAttribute("width", String(bw));
|
|
2117
2117
|
img.setAttribute("height", String(bh));
|
|
2118
|
-
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
|
|
2119
2118
|
img.setAttribute("preserveAspectRatio", "none");
|
|
2120
2119
|
img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
|
|
2121
2120
|
img.setAttribute("href", dataUrl);
|
|
2122
|
-
const
|
|
2123
|
-
const
|
|
2124
|
-
|
|
2125
|
-
const baseOpacity = Number(img.getAttribute("opacity") || "1") || 1;
|
|
2121
|
+
const alphaRaw = parseFloat(marker.getAttribute("data-alpha") || "1");
|
|
2122
|
+
const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
|
|
2123
|
+
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION * shadowAlpha));
|
|
2126
2124
|
(_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
|
-
}
|
|
2137
2125
|
} catch (error) {
|
|
2138
2126
|
console.warn("[Vector PDF] text shadow rasterization failed for one marker:", error);
|
|
2139
2127
|
try {
|
|
2140
|
-
(
|
|
2128
|
+
(_f = marker.parentNode) == null ? void 0 : _f.removeChild(marker);
|
|
2141
2129
|
} catch {
|
|
2142
2130
|
}
|
|
2143
2131
|
}
|
|
@@ -2965,7 +2953,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2965
2953
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2966
2954
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2967
2955
|
try {
|
|
2968
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2956
|
+
const { getNormalizedSvgUrl } = await import("./index-CDdfs3IB.js").then((n) => n.a6);
|
|
2969
2957
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2970
2958
|
} catch {
|
|
2971
2959
|
return null;
|
|
@@ -3774,7 +3762,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3774
3762
|
}
|
|
3775
3763
|
let fetchUrl = imageUrl;
|
|
3776
3764
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3777
|
-
const { isPrivateUrl } = await import("./index-
|
|
3765
|
+
const { isPrivateUrl } = await import("./index-CDdfs3IB.js").then((n) => n.a6);
|
|
3778
3766
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3779
3767
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3780
3768
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5875,4 +5863,4 @@ export {
|
|
|
5875
5863
|
preparePagesForExport,
|
|
5876
5864
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5877
5865
|
};
|
|
5878
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5866
|
+
//# sourceMappingURL=vectorPdfExport-CjIUU8on.js.map
|