@pixldocs/canvas-renderer 0.5.462 → 0.5.464
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-DjoKgogq.cjs → index-BFIEinvR.cjs} +44 -16
- package/dist/index-BFIEinvR.cjs.map +1 -0
- package/dist/{index-DzpYcUNd.js → index-TvXdi5B9.js} +44 -16
- package/dist/index-TvXdi5B9.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-IjuMSK-o.cjs → vectorPdfExport-BlaglUx4.cjs} +12 -10
- package/dist/{vectorPdfExport-IjuMSK-o.cjs.map → vectorPdfExport-BlaglUx4.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CFxK100y.js → vectorPdfExport-pt3O47hm.js} +12 -10
- package/dist/{vectorPdfExport-CFxK100y.js.map → vectorPdfExport-pt3O47hm.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DjoKgogq.cjs.map +0 -1
- package/dist/index-DzpYcUNd.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-TvXdi5B9.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-TvXdi5B9.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-TvXdi5B9.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);
|
|
@@ -4773,9 +4773,10 @@ async function drawElement(pdf, element, embeddedFonts, canvasWidth, canvasHeigh
|
|
|
4773
4773
|
const fitContain = ((cropData == null ? void 0 : cropData.fit) ?? element.imageFit ?? "cover") === "contain";
|
|
4774
4774
|
const alignH = element.imageAlignH ?? "center";
|
|
4775
4775
|
const alignV = element.imageAlignV ?? "middle";
|
|
4776
|
+
const containScaleVal = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
|
|
4776
4777
|
const cropSvgRect = (clipX, clipY, clipW, clipH) => {
|
|
4777
4778
|
const baseScale = fitContain ? Math.min(clipW / naturalW, clipH / naturalH) : Math.max(clipW / naturalW, clipH / naturalH);
|
|
4778
|
-
const finalScale = baseScale * (fitContain ?
|
|
4779
|
+
const finalScale = baseScale * (fitContain ? containScaleVal : cropZoomVal);
|
|
4779
4780
|
const drawW = naturalW * finalScale;
|
|
4780
4781
|
const drawH = naturalH * finalScale;
|
|
4781
4782
|
const overflowX = Math.max(0, drawW - clipW);
|
|
@@ -4783,8 +4784,8 @@ async function drawElement(pdf, element, embeddedFonts, canvasWidth, canvasHeigh
|
|
|
4783
4784
|
let offX = 0;
|
|
4784
4785
|
let offY = 0;
|
|
4785
4786
|
if (fitContain) {
|
|
4786
|
-
const slackX =
|
|
4787
|
-
const slackY =
|
|
4787
|
+
const slackX = clipW - drawW;
|
|
4788
|
+
const slackY = clipH - drawH;
|
|
4788
4789
|
offX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
|
|
4789
4790
|
offY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
|
|
4790
4791
|
} else {
|
|
@@ -5456,8 +5457,9 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5456
5457
|
const naturalW = Math.max(1, Number(element.imageNaturalWidth ?? 0) || w);
|
|
5457
5458
|
const naturalH = Math.max(1, Number(element.imageNaturalHeight ?? 0) || h);
|
|
5458
5459
|
const fitContain = (element.imageFit ?? "cover") === "contain";
|
|
5460
|
+
const containScaleVal = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
|
|
5459
5461
|
const baseScale = fitContain ? Math.min(w / naturalW, h / naturalH) : Math.max(w / naturalW, h / naturalH);
|
|
5460
|
-
const finalScale = baseScale * (fitContain ?
|
|
5462
|
+
const finalScale = baseScale * (fitContain ? containScaleVal : cropZoom);
|
|
5461
5463
|
const drawW = naturalW * finalScale;
|
|
5462
5464
|
const drawH = naturalH * finalScale;
|
|
5463
5465
|
const overflowX = Math.max(0, drawW - w);
|
|
@@ -5467,8 +5469,8 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5467
5469
|
let offsetX = 0;
|
|
5468
5470
|
let offsetY = 0;
|
|
5469
5471
|
if (fitContain) {
|
|
5470
|
-
const slackX =
|
|
5471
|
-
const slackY =
|
|
5472
|
+
const slackX = w - drawW;
|
|
5473
|
+
const slackY = h - drawH;
|
|
5472
5474
|
offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
|
|
5473
5475
|
offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
|
|
5474
5476
|
} else {
|
|
@@ -6197,4 +6199,4 @@ export {
|
|
|
6197
6199
|
preparePagesForExport,
|
|
6198
6200
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
6199
6201
|
};
|
|
6200
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
6202
|
+
//# sourceMappingURL=vectorPdfExport-pt3O47hm.js.map
|