@pixldocs/canvas-renderer 0.5.489 → 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-SOZMTq-v.cjs → index-C47g5w5y.cjs} +12 -20
- package/dist/index-C47g5w5y.cjs.map +1 -0
- package/dist/{index-DFPaf9mH.js → index-xazc-CdA.js} +12 -20
- package/dist/index-xazc-CdA.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-zW2ceM2y.js → vectorPdfExport-f828EcQ6.js} +8 -11
- package/dist/{vectorPdfExport-zW2ceM2y.js.map → vectorPdfExport-f828EcQ6.js.map} +1 -1
- package/dist/{vectorPdfExport-c8OVQAkW.cjs → vectorPdfExport-mxgjzQsw.cjs} +8 -11
- package/dist/{vectorPdfExport-c8OVQAkW.cjs.map → vectorPdfExport-mxgjzQsw.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DFPaf9mH.js.map +0 -1
- package/dist/index-SOZMTq-v.cjs.map +0 -1
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jspdf = require("jspdf");
|
|
4
4
|
const svg2pdf_js = require("svg2pdf.js");
|
|
5
5
|
const fabric = require("fabric");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-C47g5w5y.cjs");
|
|
7
7
|
const pdfFonts = require("./pdfFonts-BTj2f465.cjs");
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -3271,7 +3271,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
3271
3271
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
3272
3272
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
3273
3273
|
try {
|
|
3274
|
-
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-
|
|
3274
|
+
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-C47g5w5y.cjs")).then((n) => n.canvasImageLoader);
|
|
3275
3275
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
3276
3276
|
} catch {
|
|
3277
3277
|
return null;
|
|
@@ -4080,7 +4080,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
4080
4080
|
}
|
|
4081
4081
|
let fetchUrl = imageUrl;
|
|
4082
4082
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
4083
|
-
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-
|
|
4083
|
+
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-C47g5w5y.cjs")).then((n) => n.canvasImageLoader);
|
|
4084
4084
|
if (isPrivateUrl(imageUrl)) return null;
|
|
4085
4085
|
const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
|
|
4086
4086
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5331,7 +5331,6 @@ async function drawElementContentWithIntrinsic(pdf, element, norm, x, y, intrins
|
|
|
5331
5331
|
await drawElementContentCore(pdf, element, norm, x, y, intrinsicW, intrinsicH, embeddedFonts, canvasWidth, canvasHeight, backgroundColor, 1, liveFabricText);
|
|
5332
5332
|
}
|
|
5333
5333
|
async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFonts, canvasWidth, canvasHeight, backgroundColor, fontScale = 1, liveFabricText) {
|
|
5334
|
-
var _a;
|
|
5335
5334
|
switch (element.type) {
|
|
5336
5335
|
case "shape": {
|
|
5337
5336
|
const { shapeType, fill, stroke, strokeWidth, borderRadius, rxTL, rxTR, rxBR, rxBL } = norm;
|
|
@@ -5375,7 +5374,7 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5375
5374
|
let finalText = originalText;
|
|
5376
5375
|
let finalFontSize = fontSize * fontScale;
|
|
5377
5376
|
if (overflowPolicy === "auto-shrink") {
|
|
5378
|
-
|
|
5377
|
+
Math.max(1, finalText.split("\n").length);
|
|
5379
5378
|
const measureWidth = Math.max(1, w / PX_TO_PT);
|
|
5380
5379
|
while (finalFontSize > 1) {
|
|
5381
5380
|
const testTextbox = new fabric__namespace.Textbox(finalText, {
|
|
@@ -5390,15 +5389,13 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5390
5389
|
});
|
|
5391
5390
|
testTextbox.initDimensions();
|
|
5392
5391
|
const textHeight = (testTextbox.height || 0) * PX_TO_PT;
|
|
5393
|
-
const renderedLineCount = ((_a = testTextbox.textLines) == null ? void 0 : _a.length) || 1;
|
|
5394
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
5395
5392
|
const fitsHeight = h <= 0 || textHeight <= h;
|
|
5396
5393
|
const actualTextboxWidth = testTextbox.width ?? measureWidth;
|
|
5397
5394
|
const widthDidGrow = actualTextboxWidth > measureWidth + 0.5;
|
|
5398
5395
|
const lineWidths = testTextbox.__lineWidths;
|
|
5399
5396
|
const maxLineWidth = lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : 0;
|
|
5400
5397
|
const fitsWidth = !widthDidGrow && maxLineWidth <= measureWidth + 1;
|
|
5401
|
-
if (
|
|
5398
|
+
if (fitsHeight && fitsWidth) {
|
|
5402
5399
|
break;
|
|
5403
5400
|
}
|
|
5404
5401
|
finalFontSize--;
|
|
@@ -5416,7 +5413,7 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5416
5413
|
const lines = testTextbox.textLines || [];
|
|
5417
5414
|
if (lines.length > maxLines) {
|
|
5418
5415
|
const countLines = (testText) => {
|
|
5419
|
-
var
|
|
5416
|
+
var _a;
|
|
5420
5417
|
const tb = new fabric__namespace.Textbox(testText, {
|
|
5421
5418
|
width: w / PX_TO_PT,
|
|
5422
5419
|
fontSize: finalFontSize / PX_TO_PT,
|
|
@@ -5425,7 +5422,7 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
|
|
|
5425
5422
|
splitByGrapheme: effectiveSplitByGrapheme
|
|
5426
5423
|
});
|
|
5427
5424
|
tb.initDimensions();
|
|
5428
|
-
return ((
|
|
5425
|
+
return ((_a = tb.textLines) == null ? void 0 : _a.length) || 1;
|
|
5429
5426
|
};
|
|
5430
5427
|
let low = 0;
|
|
5431
5428
|
let high = originalText.length;
|
|
@@ -6216,4 +6213,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
|
|
|
6216
6213
|
exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
|
|
6217
6214
|
exports.preparePagesForExport = preparePagesForExport;
|
|
6218
6215
|
exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
|
|
6219
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
6216
|
+
//# sourceMappingURL=vectorPdfExport-mxgjzQsw.cjs.map
|