@pixldocs/canvas-renderer 0.5.215 → 0.5.217
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-CzwZcfGF.cjs → index-CDrMSTDa.cjs} +14 -8
- package/dist/index-CDrMSTDa.cjs.map +1 -0
- package/dist/{index-BV_MP9XQ.js → index-Ci5YA_Ps.js} +14 -8
- package/dist/index-Ci5YA_Ps.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DUohXw5V.cjs → vectorPdfExport-B8uqWQoW.cjs} +10 -6
- package/dist/vectorPdfExport-B8uqWQoW.cjs.map +1 -0
- package/dist/{vectorPdfExport-CN1fcrfR.js → vectorPdfExport-DJR9lwsV.js} +10 -6
- package/dist/vectorPdfExport-DJR9lwsV.js.map +1 -0
- package/package.json +1 -1
- package/dist/index-BV_MP9XQ.js.map +0 -1
- package/dist/index-CzwZcfGF.cjs.map +0 -1
- package/dist/vectorPdfExport-CN1fcrfR.js.map +0 -1
- package/dist/vectorPdfExport-DUohXw5V.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-Ci5YA_Ps.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;
|
|
@@ -2080,6 +2080,9 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
2080
2080
|
const by = parseFloat(marker.getAttribute("data-by") || "0");
|
|
2081
2081
|
const bw = parseFloat(marker.getAttribute("data-bw") || "0");
|
|
2082
2082
|
const bh = parseFloat(marker.getAttribute("data-bh") || "0");
|
|
2083
|
+
const spread = parseFloat(marker.getAttribute("data-spread") || "0");
|
|
2084
|
+
const alphaRaw = parseFloat(marker.getAttribute("data-alpha") || "1");
|
|
2085
|
+
const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
|
|
2083
2086
|
if (!Number.isFinite(bw) || !Number.isFinite(bh) || bw <= 0 || bh <= 0) {
|
|
2084
2087
|
(_b = marker.parentNode) == null ? void 0 : _b.removeChild(marker);
|
|
2085
2088
|
continue;
|
|
@@ -2103,7 +2106,8 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
2103
2106
|
const pxH = Math.min(4096, Math.max(8, Math.ceil(bh * scale)));
|
|
2104
2107
|
const stdDev = Math.max(0, blur / 2);
|
|
2105
2108
|
const filterId = `pdShadowBlur_${Math.random().toString(36).slice(2, 9)}`;
|
|
2106
|
-
const
|
|
2109
|
+
const spreadCss = spread > 0 ? `text,tspan,path{paint-order:stroke fill;stroke:currentColor;stroke-width:${spread.toFixed(3)}px;stroke-linejoin:round;stroke-linecap:round;}` : "";
|
|
2110
|
+
const styleBlock = fontFaceCss || spreadCss ? `<style>${fontFaceCss}${spreadCss}</style>` : "";
|
|
2107
2111
|
const miniSvg = `<svg xmlns="${SVG_NS}" xmlns:xlink="${XLINK_NS}" width="${pxW}" height="${pxH}" viewBox="${bx} ${by} ${bw} ${bh}">${styleBlock}<defs><filter id="${filterId}" filterUnits="userSpaceOnUse" x="${bx}" y="${by}" width="${bw}" height="${bh}" color-interpolation-filters="sRGB"><feOffset dx="${ox}" dy="${oy}" result="offsetShadow" /><feGaussianBlur in="offsetShadow" stdDeviation="${stdDev}" /></filter></defs><g filter="url(#${filterId})">${innerXml}</g></svg>`;
|
|
2108
2112
|
const dataUrl = await rasterSvgToPngDataUrl(miniSvg, pxW, pxH);
|
|
2109
2113
|
if (!dataUrl) {
|
|
@@ -2118,7 +2122,7 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
2118
2122
|
img.setAttribute("preserveAspectRatio", "none");
|
|
2119
2123
|
img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
|
|
2120
2124
|
img.setAttribute("href", dataUrl);
|
|
2121
|
-
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
|
|
2125
|
+
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION * shadowAlpha));
|
|
2122
2126
|
(_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
|
|
2123
2127
|
} catch (error) {
|
|
2124
2128
|
console.warn("[Vector PDF] text shadow rasterization failed for one marker:", error);
|
|
@@ -2951,7 +2955,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2951
2955
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2952
2956
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2953
2957
|
try {
|
|
2954
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2958
|
+
const { getNormalizedSvgUrl } = await import("./index-Ci5YA_Ps.js").then((n) => n.a6);
|
|
2955
2959
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2956
2960
|
} catch {
|
|
2957
2961
|
return null;
|
|
@@ -3760,7 +3764,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3760
3764
|
}
|
|
3761
3765
|
let fetchUrl = imageUrl;
|
|
3762
3766
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3763
|
-
const { isPrivateUrl } = await import("./index-
|
|
3767
|
+
const { isPrivateUrl } = await import("./index-Ci5YA_Ps.js").then((n) => n.a6);
|
|
3764
3768
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3765
3769
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3766
3770
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5861,4 +5865,4 @@ export {
|
|
|
5861
5865
|
preparePagesForExport,
|
|
5862
5866
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5863
5867
|
};
|
|
5864
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5868
|
+
//# sourceMappingURL=vectorPdfExport-DJR9lwsV.js.map
|