@pixldocs/canvas-renderer 0.5.460 → 0.5.462
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-CtJvkbzV.cjs → index-DjoKgogq.cjs} +45 -15
- package/dist/index-DjoKgogq.cjs.map +1 -0
- package/dist/{index-B306IfvT.js → index-DzpYcUNd.js} +45 -15
- package/dist/index-DzpYcUNd.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CWiNW81v.js → vectorPdfExport-CFxK100y.js} +30 -8
- package/dist/{vectorPdfExport-CWiNW81v.js.map → vectorPdfExport-CFxK100y.js.map} +1 -1
- package/dist/{vectorPdfExport-B5Xxp9RH.cjs → vectorPdfExport-IjuMSK-o.cjs} +30 -8
- package/dist/{vectorPdfExport-B5Xxp9RH.cjs.map → vectorPdfExport-IjuMSK-o.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B306IfvT.js.map +0 -1
- package/dist/index-CtJvkbzV.cjs.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-DjoKgogq.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, a6 } 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, a6 } from "./index-DzpYcUNd.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-DzpYcUNd.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;
|
|
@@ -3252,7 +3252,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
3252
3252
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
3253
3253
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
3254
3254
|
try {
|
|
3255
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
3255
|
+
const { getNormalizedSvgUrl } = await import("./index-DzpYcUNd.js").then((n) => n.a7);
|
|
3256
3256
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
3257
3257
|
} catch {
|
|
3258
3258
|
return null;
|
|
@@ -4061,7 +4061,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
4061
4061
|
}
|
|
4062
4062
|
let fetchUrl = imageUrl;
|
|
4063
4063
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
4064
|
-
const { isPrivateUrl } = await import("./index-
|
|
4064
|
+
const { isPrivateUrl } = await import("./index-DzpYcUNd.js").then((n) => n.a7);
|
|
4065
4065
|
if (isPrivateUrl(imageUrl)) return null;
|
|
4066
4066
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
4067
4067
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -4771,6 +4771,8 @@ async function drawElement(pdf, element, embeddedFonts, canvasWidth, canvasHeigh
|
|
|
4771
4771
|
const naturalW = Math.max(1, Number(element.imageNaturalWidth ?? 0) || Number(((_g = cropData == null ? void 0 : cropData._img) == null ? void 0 : _g.width) ?? 0) || frameW);
|
|
4772
4772
|
const naturalH = Math.max(1, Number(element.imageNaturalHeight ?? 0) || Number(((_h = cropData == null ? void 0 : cropData._img) == null ? void 0 : _h.height) ?? 0) || frameH);
|
|
4773
4773
|
const fitContain = ((cropData == null ? void 0 : cropData.fit) ?? element.imageFit ?? "cover") === "contain";
|
|
4774
|
+
const alignH = element.imageAlignH ?? "center";
|
|
4775
|
+
const alignV = element.imageAlignV ?? "middle";
|
|
4774
4776
|
const cropSvgRect = (clipX, clipY, clipW, clipH) => {
|
|
4775
4777
|
const baseScale = fitContain ? Math.min(clipW / naturalW, clipH / naturalH) : Math.max(clipW / naturalW, clipH / naturalH);
|
|
4776
4778
|
const finalScale = baseScale * (fitContain ? 1 : cropZoomVal);
|
|
@@ -4778,8 +4780,17 @@ async function drawElement(pdf, element, embeddedFonts, canvasWidth, canvasHeigh
|
|
|
4778
4780
|
const drawH = naturalH * finalScale;
|
|
4779
4781
|
const overflowX = Math.max(0, drawW - clipW);
|
|
4780
4782
|
const overflowY = Math.max(0, drawH - clipH);
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
+
let offX = 0;
|
|
4784
|
+
let offY = 0;
|
|
4785
|
+
if (fitContain) {
|
|
4786
|
+
const slackX = Math.max(0, clipW - drawW);
|
|
4787
|
+
const slackY = Math.max(0, clipH - drawH);
|
|
4788
|
+
offX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
|
|
4789
|
+
offY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
|
|
4790
|
+
} else {
|
|
4791
|
+
offX = overflowX > 0 ? -overflowX * (cropPanXVal - 0.5) : 0;
|
|
4792
|
+
offY = overflowY > 0 ? -overflowY * (cropPanYVal - 0.5) : 0;
|
|
4793
|
+
}
|
|
4783
4794
|
return {
|
|
4784
4795
|
x: clipX + clipW / 2 + offX - drawW / 2,
|
|
4785
4796
|
y: clipY + clipH / 2 + offY - drawH / 2,
|
|
@@ -5451,8 +5462,19 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5451
5462
|
const drawH = naturalH * finalScale;
|
|
5452
5463
|
const overflowX = Math.max(0, drawW - w);
|
|
5453
5464
|
const overflowY = Math.max(0, drawH - h);
|
|
5454
|
-
const
|
|
5455
|
-
const
|
|
5465
|
+
const alignH = element.imageAlignH ?? "center";
|
|
5466
|
+
const alignV = element.imageAlignV ?? "middle";
|
|
5467
|
+
let offsetX = 0;
|
|
5468
|
+
let offsetY = 0;
|
|
5469
|
+
if (fitContain) {
|
|
5470
|
+
const slackX = Math.max(0, w - drawW);
|
|
5471
|
+
const slackY = Math.max(0, h - drawH);
|
|
5472
|
+
offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
|
|
5473
|
+
offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
|
|
5474
|
+
} else {
|
|
5475
|
+
offsetX = overflowX > 0 ? -overflowX * (cropPanX - 0.5) : 0;
|
|
5476
|
+
offsetY = overflowY > 0 ? -overflowY * (cropPanY - 0.5) : 0;
|
|
5477
|
+
}
|
|
5456
5478
|
const svgX = x + w / 2 + offsetX - drawW / 2;
|
|
5457
5479
|
const svgY = y + h / 2 + offsetY - drawH / 2;
|
|
5458
5480
|
try {
|
|
@@ -6175,4 +6197,4 @@ export {
|
|
|
6175
6197
|
preparePagesForExport,
|
|
6176
6198
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
6177
6199
|
};
|
|
6178
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
6200
|
+
//# sourceMappingURL=vectorPdfExport-CFxK100y.js.map
|