@pixldocs/canvas-renderer 0.5.488 → 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-D0tFaSTn.js → index-DFPaf9mH.js} +23 -12
- package/dist/index-DFPaf9mH.js.map +1 -0
- package/dist/{index-0K5eJY1O.cjs → index-SOZMTq-v.cjs} +23 -12
- package/dist/index-SOZMTq-v.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CoHsXSrT.cjs → vectorPdfExport-c8OVQAkW.cjs} +4 -4
- package/dist/{vectorPdfExport-CoHsXSrT.cjs.map → vectorPdfExport-c8OVQAkW.cjs.map} +1 -1
- package/dist/{vectorPdfExport-jRSKADbv.js → vectorPdfExport-zW2ceM2y.js} +4 -4
- package/dist/{vectorPdfExport-jRSKADbv.js.map → vectorPdfExport-zW2ceM2y.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-0K5eJY1O.cjs.map +0 -1
- package/dist/index-D0tFaSTn.js.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;
|
|
@@ -18970,6 +18978,7 @@ const PageCanvas = forwardRef(
|
|
|
18970
18978
|
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
18971
18979
|
const elementHeight = typeof element.height === "number" ? element.height : 0;
|
|
18972
18980
|
const heightBound = Math.max(elementHeight, minBoxHForShrink);
|
|
18981
|
+
const explicitLineCount = Math.max(1, text.split("\n").length);
|
|
18973
18982
|
while (fontSize > 1) {
|
|
18974
18983
|
const testTextbox = new fabric.Textbox(text, {
|
|
18975
18984
|
width: fixedWidth,
|
|
@@ -18979,13 +18988,15 @@ const PageCanvas = forwardRef(
|
|
|
18979
18988
|
fontStyle: element.fontStyle || "normal",
|
|
18980
18989
|
lineHeight: element.lineHeight || 1.2,
|
|
18981
18990
|
charSpacing: element.charSpacing || 0,
|
|
18982
|
-
splitByGrapheme:
|
|
18991
|
+
splitByGrapheme: false
|
|
18983
18992
|
});
|
|
18984
18993
|
testTextbox.initDimensions();
|
|
18985
18994
|
const textHeight = testTextbox.height || 0;
|
|
18995
|
+
const renderedLineCount = ((_c2 = testTextbox.textLines) == null ? void 0 : _c2.length) || 1;
|
|
18996
|
+
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
18986
18997
|
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
18987
18998
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
18988
|
-
if (fitsHeight && fitsWidth) {
|
|
18999
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
|
|
18989
19000
|
break;
|
|
18990
19001
|
}
|
|
18991
19002
|
fontSize--;
|
|
@@ -19106,7 +19117,7 @@ const PageCanvas = forwardRef(
|
|
|
19106
19117
|
} catch {
|
|
19107
19118
|
}
|
|
19108
19119
|
obj.dirty = true;
|
|
19109
|
-
(
|
|
19120
|
+
(_d = obj.setCoords) == null ? void 0 : _d.call(obj);
|
|
19110
19121
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
19111
19122
|
c: element.textBgColor ?? null,
|
|
19112
19123
|
g: element.textBgGradient ?? null,
|
|
@@ -26423,9 +26434,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26423
26434
|
}
|
|
26424
26435
|
return svgString;
|
|
26425
26436
|
}
|
|
26426
|
-
const resolvedPackageVersion = "0.5.
|
|
26437
|
+
const resolvedPackageVersion = "0.5.489";
|
|
26427
26438
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26428
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26439
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.489";
|
|
26429
26440
|
const roundParityValue = (value) => {
|
|
26430
26441
|
if (typeof value !== "number") return value;
|
|
26431
26442
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27239,7 +27250,7 @@ class PixldocsRenderer {
|
|
|
27239
27250
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27240
27251
|
}
|
|
27241
27252
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27242
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
27253
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-zW2ceM2y.js");
|
|
27243
27254
|
const prepared = preparePagesForExport(
|
|
27244
27255
|
cloned.pages,
|
|
27245
27256
|
canvasWidth,
|
|
@@ -29559,7 +29570,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29559
29570
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29560
29571
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29561
29572
|
try {
|
|
29562
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29573
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-zW2ceM2y.js");
|
|
29563
29574
|
try {
|
|
29564
29575
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29565
29576
|
} catch {
|
|
@@ -29876,4 +29887,4 @@ export {
|
|
|
29876
29887
|
buildTeaserBlurFlatKeys as y,
|
|
29877
29888
|
collectFontDescriptorsFromConfig as z
|
|
29878
29889
|
};
|
|
29879
|
-
//# sourceMappingURL=index-
|
|
29890
|
+
//# sourceMappingURL=index-DFPaf9mH.js.map
|