@pixldocs/canvas-renderer 0.5.488 → 0.5.490
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-0K5eJY1O.cjs → index-C47g5w5y.cjs} +9 -6
- package/dist/index-C47g5w5y.cjs.map +1 -0
- package/dist/{index-D0tFaSTn.js → index-xazc-CdA.js} +9 -6
- package/dist/index-xazc-CdA.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-jRSKADbv.js → vectorPdfExport-f828EcQ6.js} +8 -11
- package/dist/{vectorPdfExport-jRSKADbv.js.map → vectorPdfExport-f828EcQ6.js.map} +1 -1
- package/dist/{vectorPdfExport-CoHsXSrT.cjs → vectorPdfExport-mxgjzQsw.cjs} +8 -11
- package/dist/{vectorPdfExport-CoHsXSrT.cjs.map → vectorPdfExport-mxgjzQsw.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-0K5eJY1O.cjs.map +0 -1
- package/dist/index-D0tFaSTn.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-C47g5w5y.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-xazc-CdA.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-xazc-CdA.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-xazc-CdA.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-xazc-CdA.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);
|
|
@@ -5312,7 +5312,6 @@ async function drawElementContentWithIntrinsic(pdf, element, norm, x, y, intrins
|
|
|
5312
5312
|
await drawElementContentCore(pdf, element, norm, x, y, intrinsicW, intrinsicH, embeddedFonts, canvasWidth, canvasHeight, backgroundColor, 1, liveFabricText);
|
|
5313
5313
|
}
|
|
5314
5314
|
async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFonts, canvasWidth, canvasHeight, backgroundColor, fontScale = 1, liveFabricText) {
|
|
5315
|
-
var _a;
|
|
5316
5315
|
switch (element.type) {
|
|
5317
5316
|
case "shape": {
|
|
5318
5317
|
const { shapeType, fill, stroke, strokeWidth, borderRadius, rxTL, rxTR, rxBR, rxBL } = norm;
|
|
@@ -5356,7 +5355,7 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5356
5355
|
let finalText = originalText;
|
|
5357
5356
|
let finalFontSize = fontSize * fontScale;
|
|
5358
5357
|
if (overflowPolicy === "auto-shrink") {
|
|
5359
|
-
|
|
5358
|
+
Math.max(1, finalText.split("\n").length);
|
|
5360
5359
|
const measureWidth = Math.max(1, w / PX_TO_PT);
|
|
5361
5360
|
while (finalFontSize > 1) {
|
|
5362
5361
|
const testTextbox = new fabric.Textbox(finalText, {
|
|
@@ -5371,15 +5370,13 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5371
5370
|
});
|
|
5372
5371
|
testTextbox.initDimensions();
|
|
5373
5372
|
const textHeight = (testTextbox.height || 0) * PX_TO_PT;
|
|
5374
|
-
const renderedLineCount = ((_a = testTextbox.textLines) == null ? void 0 : _a.length) || 1;
|
|
5375
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
5376
5373
|
const fitsHeight = h <= 0 || textHeight <= h;
|
|
5377
5374
|
const actualTextboxWidth = testTextbox.width ?? measureWidth;
|
|
5378
5375
|
const widthDidGrow = actualTextboxWidth > measureWidth + 0.5;
|
|
5379
5376
|
const lineWidths = testTextbox.__lineWidths;
|
|
5380
5377
|
const maxLineWidth = lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : 0;
|
|
5381
5378
|
const fitsWidth = !widthDidGrow && maxLineWidth <= measureWidth + 1;
|
|
5382
|
-
if (
|
|
5379
|
+
if (fitsHeight && fitsWidth) {
|
|
5383
5380
|
break;
|
|
5384
5381
|
}
|
|
5385
5382
|
finalFontSize--;
|
|
@@ -5397,7 +5394,7 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5397
5394
|
const lines = testTextbox.textLines || [];
|
|
5398
5395
|
if (lines.length > maxLines) {
|
|
5399
5396
|
const countLines = (testText) => {
|
|
5400
|
-
var
|
|
5397
|
+
var _a;
|
|
5401
5398
|
const tb = new fabric.Textbox(testText, {
|
|
5402
5399
|
width: w / PX_TO_PT,
|
|
5403
5400
|
fontSize: finalFontSize / PX_TO_PT,
|
|
@@ -5406,7 +5403,7 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5406
5403
|
splitByGrapheme: effectiveSplitByGrapheme
|
|
5407
5404
|
});
|
|
5408
5405
|
tb.initDimensions();
|
|
5409
|
-
return ((
|
|
5406
|
+
return ((_a = tb.textLines) == null ? void 0 : _a.length) || 1;
|
|
5410
5407
|
};
|
|
5411
5408
|
let low = 0;
|
|
5412
5409
|
let high = originalText.length;
|
|
@@ -6199,4 +6196,4 @@ export {
|
|
|
6199
6196
|
preparePagesForExport,
|
|
6200
6197
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
6201
6198
|
};
|
|
6202
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
6199
|
+
//# sourceMappingURL=vectorPdfExport-f828EcQ6.js.map
|