@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
|
@@ -552,6 +552,7 @@ function getCacheKey(element) {
|
|
|
552
552
|
});
|
|
553
553
|
}
|
|
554
554
|
function measureTextHeight(element) {
|
|
555
|
+
var _a2;
|
|
555
556
|
if (element.type !== "text") {
|
|
556
557
|
return element.height || 20;
|
|
557
558
|
}
|
|
@@ -570,6 +571,7 @@ function measureTextHeight(element) {
|
|
|
570
571
|
if (overflowPolicy === "auto-shrink") {
|
|
571
572
|
const minBoxH = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
572
573
|
const baseHeight = typeof element.height === "number" ? Math.max(element.height, minBoxH) : minBoxH > 0 ? minBoxH : element.height;
|
|
574
|
+
const explicitLineCount = Math.max(1, textToMeasure.split("\n").length);
|
|
573
575
|
while (fontSize > 1) {
|
|
574
576
|
const testTb = new fabric__namespace.Textbox(textToMeasure, {
|
|
575
577
|
width: measureWidth,
|
|
@@ -583,9 +585,11 @@ function measureTextHeight(element) {
|
|
|
583
585
|
});
|
|
584
586
|
testTb.initDimensions();
|
|
585
587
|
const textHeight = testTb.height || 0;
|
|
588
|
+
const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
|
|
589
|
+
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
586
590
|
const fitsHeight = !baseHeight || textHeight <= baseHeight;
|
|
587
591
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTb, measureWidth);
|
|
588
|
-
if (fitsHeight && fitsWidth) break;
|
|
592
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
|
|
589
593
|
fontSize--;
|
|
590
594
|
}
|
|
591
595
|
const finalTb = new fabric__namespace.Textbox(textToMeasure, {
|
|
@@ -653,6 +657,7 @@ function clearMeasurementCache() {
|
|
|
653
657
|
heightCache.clear();
|
|
654
658
|
}
|
|
655
659
|
function computeAutoShrinkFontSize(element) {
|
|
660
|
+
var _a2;
|
|
656
661
|
const baseFontSize = element.fontSize || 16;
|
|
657
662
|
if (element.overflowPolicy !== "auto-shrink") return baseFontSize;
|
|
658
663
|
const text = element.text || element.content || "";
|
|
@@ -662,6 +667,7 @@ function computeAutoShrinkFontSize(element) {
|
|
|
662
667
|
if (!height) return baseFontSize;
|
|
663
668
|
let fontSize = baseFontSize;
|
|
664
669
|
try {
|
|
670
|
+
const explicitLineCount = Math.max(1, text.split("\n").length);
|
|
665
671
|
while (fontSize > 1) {
|
|
666
672
|
const testTb = new fabric__namespace.Textbox(text, {
|
|
667
673
|
width,
|
|
@@ -675,11 +681,13 @@ function computeAutoShrinkFontSize(element) {
|
|
|
675
681
|
});
|
|
676
682
|
testTb.initDimensions();
|
|
677
683
|
const textHeight = testTb.height || 0;
|
|
684
|
+
const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
|
|
685
|
+
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
678
686
|
const fitsHeight = textHeight <= height;
|
|
679
687
|
const lineWidths = testTb.__lineWidths;
|
|
680
688
|
const maxLineWidth = lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : 0;
|
|
681
689
|
const fitsWidth = maxLineWidth <= width + 1;
|
|
682
|
-
if (fitsHeight && fitsWidth) break;
|
|
690
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
|
|
683
691
|
fontSize--;
|
|
684
692
|
}
|
|
685
693
|
} catch (e) {
|
|
@@ -9889,7 +9897,7 @@ function createText(element) {
|
|
|
9889
9897
|
iterationSamples.push(lastIter);
|
|
9890
9898
|
}
|
|
9891
9899
|
}
|
|
9892
|
-
if (fitsHeight && fitsWidth) {
|
|
9900
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
|
|
9893
9901
|
breakReason = "fits";
|
|
9894
9902
|
break;
|
|
9895
9903
|
}
|
|
@@ -18604,7 +18612,7 @@ const PageCanvas = react.forwardRef(
|
|
|
18604
18612
|
return unsub;
|
|
18605
18613
|
}, []);
|
|
18606
18614
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
18607
|
-
var _a2, _b2, _c2;
|
|
18615
|
+
var _a2, _b2, _c2, _d;
|
|
18608
18616
|
const fc = fabricRef.current;
|
|
18609
18617
|
if (fc && isTransforming(fc)) {
|
|
18610
18618
|
return;
|
|
@@ -18986,7 +18994,9 @@ const PageCanvas = react.forwardRef(
|
|
|
18986
18994
|
const splitByGrapheme = overflowPolicy === "auto-shrink" ? false : element.splitByGrapheme ?? element.wordWrap === "break-word";
|
|
18987
18995
|
if (overflowPolicy === "auto-shrink") {
|
|
18988
18996
|
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
18989
|
-
const
|
|
18997
|
+
const elementHeight = typeof element.height === "number" ? element.height : 0;
|
|
18998
|
+
const heightBound = Math.max(elementHeight, minBoxHForShrink);
|
|
18999
|
+
const explicitLineCount = Math.max(1, text.split("\n").length);
|
|
18990
19000
|
while (fontSize > 1) {
|
|
18991
19001
|
const testTextbox = new fabric__namespace.Textbox(text, {
|
|
18992
19002
|
width: fixedWidth,
|
|
@@ -18996,13 +19006,15 @@ const PageCanvas = react.forwardRef(
|
|
|
18996
19006
|
fontStyle: element.fontStyle || "normal",
|
|
18997
19007
|
lineHeight: element.lineHeight || 1.2,
|
|
18998
19008
|
charSpacing: element.charSpacing || 0,
|
|
18999
|
-
splitByGrapheme:
|
|
19009
|
+
splitByGrapheme: false
|
|
19000
19010
|
});
|
|
19001
19011
|
testTextbox.initDimensions();
|
|
19002
19012
|
const textHeight = testTextbox.height || 0;
|
|
19013
|
+
const renderedLineCount = ((_c2 = testTextbox.textLines) == null ? void 0 : _c2.length) || 1;
|
|
19014
|
+
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
19003
19015
|
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
19004
19016
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
19005
|
-
if (fitsHeight && fitsWidth) {
|
|
19017
|
+
if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
|
|
19006
19018
|
break;
|
|
19007
19019
|
}
|
|
19008
19020
|
fontSize--;
|
|
@@ -19123,7 +19135,7 @@ const PageCanvas = react.forwardRef(
|
|
|
19123
19135
|
} catch {
|
|
19124
19136
|
}
|
|
19125
19137
|
obj.dirty = true;
|
|
19126
|
-
(
|
|
19138
|
+
(_d = obj.setCoords) == null ? void 0 : _d.call(obj);
|
|
19127
19139
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
19128
19140
|
c: element.textBgColor ?? null,
|
|
19129
19141
|
g: element.textBgGradient ?? null,
|
|
@@ -26440,9 +26452,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26440
26452
|
}
|
|
26441
26453
|
return svgString;
|
|
26442
26454
|
}
|
|
26443
|
-
const resolvedPackageVersion = "0.5.
|
|
26455
|
+
const resolvedPackageVersion = "0.5.489";
|
|
26444
26456
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26445
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26457
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.489";
|
|
26446
26458
|
const roundParityValue = (value) => {
|
|
26447
26459
|
if (typeof value !== "number") return value;
|
|
26448
26460
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27256,7 +27268,7 @@ class PixldocsRenderer {
|
|
|
27256
27268
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27257
27269
|
}
|
|
27258
27270
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27259
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27271
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-c8OVQAkW.cjs"));
|
|
27260
27272
|
const prepared = preparePagesForExport(
|
|
27261
27273
|
cloned.pages,
|
|
27262
27274
|
canvasWidth,
|
|
@@ -29576,7 +29588,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29576
29588
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29577
29589
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29578
29590
|
try {
|
|
29579
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29591
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-c8OVQAkW.cjs"));
|
|
29580
29592
|
try {
|
|
29581
29593
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29582
29594
|
} catch {
|
|
@@ -29890,4 +29902,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29890
29902
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29891
29903
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29892
29904
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29893
|
-
//# sourceMappingURL=index-
|
|
29905
|
+
//# sourceMappingURL=index-SOZMTq-v.cjs.map
|