@pixldocs/canvas-renderer 0.5.487 → 0.5.489
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-CqRau2aM.js → index-DFPaf9mH.js} +25 -13
- package/dist/index-DFPaf9mH.js.map +1 -0
- package/dist/{index-eyHORcg9.cjs → index-SOZMTq-v.cjs} +25 -13
- package/dist/index-SOZMTq-v.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-SQN2BQR0.cjs → vectorPdfExport-c8OVQAkW.cjs} +4 -4
- package/dist/{vectorPdfExport-SQN2BQR0.cjs.map → vectorPdfExport-c8OVQAkW.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CjRFYSDp.js → vectorPdfExport-zW2ceM2y.js} +4 -4
- package/dist/{vectorPdfExport-CjRFYSDp.js.map → vectorPdfExport-zW2ceM2y.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CqRau2aM.js.map +0 -1
- package/dist/index-eyHORcg9.cjs.map +0 -1
|
@@ -534,6 +534,7 @@ function getCacheKey(element) {
|
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
536
|
function measureTextHeight(element) {
|
|
537
|
+
var _a2;
|
|
537
538
|
if (element.type !== "text") {
|
|
538
539
|
return element.height || 20;
|
|
539
540
|
}
|
|
@@ -552,6 +553,7 @@ function measureTextHeight(element) {
|
|
|
552
553
|
if (overflowPolicy === "auto-shrink") {
|
|
553
554
|
const minBoxH = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
554
555
|
const baseHeight = typeof element.height === "number" ? Math.max(element.height, minBoxH) : minBoxH > 0 ? minBoxH : element.height;
|
|
556
|
+
const explicitLineCount = Math.max(1, textToMeasure.split("\n").length);
|
|
555
557
|
while (fontSize > 1) {
|
|
556
558
|
const testTb = new fabric.Textbox(textToMeasure, {
|
|
557
559
|
width: measureWidth,
|
|
@@ -565,9 +567,11 @@ function measureTextHeight(element) {
|
|
|
565
567
|
});
|
|
566
568
|
testTb.initDimensions();
|
|
567
569
|
const textHeight = testTb.height || 0;
|
|
570
|
+
const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
|
|
571
|
+
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
568
572
|
const fitsHeight = !baseHeight || textHeight <= baseHeight;
|
|
569
573
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTb, measureWidth);
|
|
570
|
-
if (fitsHeight && fitsWidth) break;
|
|
574
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
|
|
571
575
|
fontSize--;
|
|
572
576
|
}
|
|
573
577
|
const finalTb = new fabric.Textbox(textToMeasure, {
|
|
@@ -635,6 +639,7 @@ function clearMeasurementCache() {
|
|
|
635
639
|
heightCache.clear();
|
|
636
640
|
}
|
|
637
641
|
function computeAutoShrinkFontSize(element) {
|
|
642
|
+
var _a2;
|
|
638
643
|
const baseFontSize = element.fontSize || 16;
|
|
639
644
|
if (element.overflowPolicy !== "auto-shrink") return baseFontSize;
|
|
640
645
|
const text = element.text || element.content || "";
|
|
@@ -644,6 +649,7 @@ function computeAutoShrinkFontSize(element) {
|
|
|
644
649
|
if (!height) return baseFontSize;
|
|
645
650
|
let fontSize = baseFontSize;
|
|
646
651
|
try {
|
|
652
|
+
const explicitLineCount = Math.max(1, text.split("\n").length);
|
|
647
653
|
while (fontSize > 1) {
|
|
648
654
|
const testTb = new fabric.Textbox(text, {
|
|
649
655
|
width,
|
|
@@ -657,11 +663,13 @@ function computeAutoShrinkFontSize(element) {
|
|
|
657
663
|
});
|
|
658
664
|
testTb.initDimensions();
|
|
659
665
|
const textHeight = testTb.height || 0;
|
|
666
|
+
const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
|
|
667
|
+
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
660
668
|
const fitsHeight = textHeight <= height;
|
|
661
669
|
const lineWidths = testTb.__lineWidths;
|
|
662
670
|
const maxLineWidth = lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : 0;
|
|
663
671
|
const fitsWidth = maxLineWidth <= width + 1;
|
|
664
|
-
if (fitsHeight && fitsWidth) break;
|
|
672
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
|
|
665
673
|
fontSize--;
|
|
666
674
|
}
|
|
667
675
|
} catch (e) {
|
|
@@ -9871,7 +9879,7 @@ function createText(element) {
|
|
|
9871
9879
|
iterationSamples.push(lastIter);
|
|
9872
9880
|
}
|
|
9873
9881
|
}
|
|
9874
|
-
if (fitsHeight && fitsWidth) {
|
|
9882
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
|
|
9875
9883
|
breakReason = "fits";
|
|
9876
9884
|
break;
|
|
9877
9885
|
}
|
|
@@ -18586,7 +18594,7 @@ const PageCanvas = forwardRef(
|
|
|
18586
18594
|
return unsub;
|
|
18587
18595
|
}, []);
|
|
18588
18596
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
18589
|
-
var _a2, _b2, _c2;
|
|
18597
|
+
var _a2, _b2, _c2, _d;
|
|
18590
18598
|
const fc = fabricRef.current;
|
|
18591
18599
|
if (fc && isTransforming(fc)) {
|
|
18592
18600
|
return;
|
|
@@ -18968,7 +18976,9 @@ const PageCanvas = forwardRef(
|
|
|
18968
18976
|
const splitByGrapheme = overflowPolicy === "auto-shrink" ? false : element.splitByGrapheme ?? element.wordWrap === "break-word";
|
|
18969
18977
|
if (overflowPolicy === "auto-shrink") {
|
|
18970
18978
|
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
18971
|
-
const
|
|
18979
|
+
const elementHeight = typeof element.height === "number" ? element.height : 0;
|
|
18980
|
+
const heightBound = Math.max(elementHeight, minBoxHForShrink);
|
|
18981
|
+
const explicitLineCount = Math.max(1, text.split("\n").length);
|
|
18972
18982
|
while (fontSize > 1) {
|
|
18973
18983
|
const testTextbox = new fabric.Textbox(text, {
|
|
18974
18984
|
width: fixedWidth,
|
|
@@ -18978,13 +18988,15 @@ const PageCanvas = forwardRef(
|
|
|
18978
18988
|
fontStyle: element.fontStyle || "normal",
|
|
18979
18989
|
lineHeight: element.lineHeight || 1.2,
|
|
18980
18990
|
charSpacing: element.charSpacing || 0,
|
|
18981
|
-
splitByGrapheme:
|
|
18991
|
+
splitByGrapheme: false
|
|
18982
18992
|
});
|
|
18983
18993
|
testTextbox.initDimensions();
|
|
18984
18994
|
const textHeight = testTextbox.height || 0;
|
|
18995
|
+
const renderedLineCount = ((_c2 = testTextbox.textLines) == null ? void 0 : _c2.length) || 1;
|
|
18996
|
+
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
18985
18997
|
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
18986
18998
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
18987
|
-
if (fitsHeight && fitsWidth) {
|
|
18999
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
|
|
18988
19000
|
break;
|
|
18989
19001
|
}
|
|
18990
19002
|
fontSize--;
|
|
@@ -19105,7 +19117,7 @@ const PageCanvas = forwardRef(
|
|
|
19105
19117
|
} catch {
|
|
19106
19118
|
}
|
|
19107
19119
|
obj.dirty = true;
|
|
19108
|
-
(
|
|
19120
|
+
(_d = obj.setCoords) == null ? void 0 : _d.call(obj);
|
|
19109
19121
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
19110
19122
|
c: element.textBgColor ?? null,
|
|
19111
19123
|
g: element.textBgGradient ?? null,
|
|
@@ -26422,9 +26434,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26422
26434
|
}
|
|
26423
26435
|
return svgString;
|
|
26424
26436
|
}
|
|
26425
|
-
const resolvedPackageVersion = "0.5.
|
|
26437
|
+
const resolvedPackageVersion = "0.5.489";
|
|
26426
26438
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26427
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26439
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.489";
|
|
26428
26440
|
const roundParityValue = (value) => {
|
|
26429
26441
|
if (typeof value !== "number") return value;
|
|
26430
26442
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27238,7 +27250,7 @@ class PixldocsRenderer {
|
|
|
27238
27250
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27239
27251
|
}
|
|
27240
27252
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27241
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
27253
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-zW2ceM2y.js");
|
|
27242
27254
|
const prepared = preparePagesForExport(
|
|
27243
27255
|
cloned.pages,
|
|
27244
27256
|
canvasWidth,
|
|
@@ -29558,7 +29570,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29558
29570
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29559
29571
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29560
29572
|
try {
|
|
29561
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29573
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-zW2ceM2y.js");
|
|
29562
29574
|
try {
|
|
29563
29575
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29564
29576
|
} catch {
|
|
@@ -29875,4 +29887,4 @@ export {
|
|
|
29875
29887
|
buildTeaserBlurFlatKeys as y,
|
|
29876
29888
|
collectFontDescriptorsFromConfig as z
|
|
29877
29889
|
};
|
|
29878
|
-
//# sourceMappingURL=index-
|
|
29890
|
+
//# sourceMappingURL=index-DFPaf9mH.js.map
|