@pixldocs/canvas-renderer 0.5.214 → 0.5.216
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-CDdfs3IB.js → index-Bpa0-8Hq.js} +86 -17
- package/dist/index-Bpa0-8Hq.js.map +1 -0
- package/dist/{index-Cy2_ElDZ.cjs → index-C5McWFUS.cjs} +86 -17
- package/dist/index-C5McWFUS.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CjIUU8on.js → vectorPdfExport-DZD415Qf.js} +10 -8
- package/dist/vectorPdfExport-DZD415Qf.js.map +1 -0
- package/dist/{vectorPdfExport-BBG0QRse.cjs → vectorPdfExport-K3LAdOXU.cjs} +10 -8
- package/dist/vectorPdfExport-K3LAdOXU.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-CDdfs3IB.js.map +0 -1
- package/dist/index-Cy2_ElDZ.cjs.map +0 -1
- package/dist/vectorPdfExport-BBG0QRse.cjs.map +0 -1
- package/dist/vectorPdfExport-CjIUU8on.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-C5McWFUS.cjs");
|
|
4
4
|
exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
|
|
5
5
|
exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
|
|
6
6
|
exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5 } from "./index-
|
|
1
|
+
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5 } from "./index-Bpa0-8Hq.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEPLOYMENT_VERSION_MARKER,
|
|
4
4
|
F as FONT_FALLBACK_DEVANAGARI,
|
|
@@ -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-Bpa0-8Hq.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;
|
|
@@ -150,7 +150,7 @@ async function ensureImageDecoded(img) {
|
|
|
150
150
|
} catch {
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
const SHADOW_RASTER_ALPHA_COMPENSATION =
|
|
153
|
+
const SHADOW_RASTER_ALPHA_COMPENSATION = 1;
|
|
154
154
|
function collectFontSpecsFromShadowMarkup(markup) {
|
|
155
155
|
const specs = /* @__PURE__ */ new Set();
|
|
156
156
|
const re = /<(?:text|tspan)\b[^>]*>/gi;
|
|
@@ -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,8 +2122,6 @@ 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
|
-
const alphaRaw = parseFloat(marker.getAttribute("data-alpha") || "1");
|
|
2122
|
-
const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
|
|
2123
2125
|
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION * shadowAlpha));
|
|
2124
2126
|
(_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
|
|
2125
2127
|
} catch (error) {
|
|
@@ -2953,7 +2955,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2953
2955
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2954
2956
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2955
2957
|
try {
|
|
2956
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2958
|
+
const { getNormalizedSvgUrl } = await import("./index-Bpa0-8Hq.js").then((n) => n.a6);
|
|
2957
2959
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2958
2960
|
} catch {
|
|
2959
2961
|
return null;
|
|
@@ -3762,7 +3764,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3762
3764
|
}
|
|
3763
3765
|
let fetchUrl = imageUrl;
|
|
3764
3766
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3765
|
-
const { isPrivateUrl } = await import("./index-
|
|
3767
|
+
const { isPrivateUrl } = await import("./index-Bpa0-8Hq.js").then((n) => n.a6);
|
|
3766
3768
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3767
3769
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3768
3770
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5863,4 +5865,4 @@ export {
|
|
|
5863
5865
|
preparePagesForExport,
|
|
5864
5866
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5865
5867
|
};
|
|
5866
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5868
|
+
//# sourceMappingURL=vectorPdfExport-DZD415Qf.js.map
|