@pixldocs/canvas-renderer 0.5.489 → 0.5.491
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-DFPaf9mH.js → index-Cr96RvlZ.js} +14 -24
- package/dist/index-Cr96RvlZ.js.map +1 -0
- package/dist/{index-SOZMTq-v.cjs → index-sfUNqu61.cjs} +14 -24
- package/dist/index-sfUNqu61.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-zW2ceM2y.js → vectorPdfExport-7V15HkWe.js} +8 -11
- package/dist/{vectorPdfExport-zW2ceM2y.js.map → vectorPdfExport-7V15HkWe.js.map} +1 -1
- package/dist/{vectorPdfExport-c8OVQAkW.cjs → vectorPdfExport-BWUlBEaK.cjs} +8 -11
- package/dist/{vectorPdfExport-c8OVQAkW.cjs.map → vectorPdfExport-BWUlBEaK.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
|
@@ -552,7 +552,6 @@ function getCacheKey(element) {
|
|
|
552
552
|
});
|
|
553
553
|
}
|
|
554
554
|
function measureTextHeight(element) {
|
|
555
|
-
var _a2;
|
|
556
555
|
if (element.type !== "text") {
|
|
557
556
|
return element.height || 20;
|
|
558
557
|
}
|
|
@@ -585,11 +584,9 @@ function measureTextHeight(element) {
|
|
|
585
584
|
});
|
|
586
585
|
testTb.initDimensions();
|
|
587
586
|
const textHeight = testTb.height || 0;
|
|
588
|
-
const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
|
|
589
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
590
587
|
const fitsHeight = !baseHeight || textHeight <= baseHeight;
|
|
591
588
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTb, measureWidth);
|
|
592
|
-
if (
|
|
589
|
+
if (fitsHeight && fitsWidth) break;
|
|
593
590
|
fontSize--;
|
|
594
591
|
}
|
|
595
592
|
const finalTb = new fabric__namespace.Textbox(textToMeasure, {
|
|
@@ -657,7 +654,6 @@ function clearMeasurementCache() {
|
|
|
657
654
|
heightCache.clear();
|
|
658
655
|
}
|
|
659
656
|
function computeAutoShrinkFontSize(element) {
|
|
660
|
-
var _a2;
|
|
661
657
|
const baseFontSize = element.fontSize || 16;
|
|
662
658
|
if (element.overflowPolicy !== "auto-shrink") return baseFontSize;
|
|
663
659
|
const text = element.text || element.content || "";
|
|
@@ -681,13 +677,11 @@ function computeAutoShrinkFontSize(element) {
|
|
|
681
677
|
});
|
|
682
678
|
testTb.initDimensions();
|
|
683
679
|
const textHeight = testTb.height || 0;
|
|
684
|
-
const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
|
|
685
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
686
680
|
const fitsHeight = textHeight <= height;
|
|
687
681
|
const lineWidths = testTb.__lineWidths;
|
|
688
682
|
const maxLineWidth = lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : 0;
|
|
689
683
|
const fitsWidth = maxLineWidth <= width + 1;
|
|
690
|
-
if (
|
|
684
|
+
if (fitsHeight && fitsWidth) break;
|
|
691
685
|
fontSize--;
|
|
692
686
|
}
|
|
693
687
|
} catch (e) {
|
|
@@ -9897,7 +9891,7 @@ function createText(element) {
|
|
|
9897
9891
|
iterationSamples.push(lastIter);
|
|
9898
9892
|
}
|
|
9899
9893
|
}
|
|
9900
|
-
if (
|
|
9894
|
+
if (fitsHeight && fitsWidth) {
|
|
9901
9895
|
breakReason = "fits";
|
|
9902
9896
|
break;
|
|
9903
9897
|
}
|
|
@@ -17257,15 +17251,13 @@ const PageCanvas = react.forwardRef(
|
|
|
17257
17251
|
}
|
|
17258
17252
|
updateElement(elementId, {
|
|
17259
17253
|
text: newText,
|
|
17260
|
-
...typeof nextHeight === "number" && nextHeight > 0 && { height: nextHeight }
|
|
17261
|
-
...target.styles && Object.keys(target.styles).length > 0 ? { styles: JSON.parse(JSON.stringify(target.styles)) } : {}
|
|
17254
|
+
...typeof nextHeight === "number" && nextHeight > 0 && { height: nextHeight }
|
|
17262
17255
|
});
|
|
17263
17256
|
} else {
|
|
17264
17257
|
updateElement(elementId, {
|
|
17265
17258
|
text: newText,
|
|
17266
17259
|
...fabricHeight > 0 && { height: fabricHeight },
|
|
17267
|
-
...fabricWidth > 0 && { width: fabricWidth }
|
|
17268
|
-
...target.styles && Object.keys(target.styles).length > 0 ? { styles: JSON.parse(JSON.stringify(target.styles)) } : {}
|
|
17260
|
+
...fabricWidth > 0 && { width: fabricWidth }
|
|
17269
17261
|
});
|
|
17270
17262
|
}
|
|
17271
17263
|
commitHistory2();
|
|
@@ -18612,7 +18604,7 @@ const PageCanvas = react.forwardRef(
|
|
|
18612
18604
|
return unsub;
|
|
18613
18605
|
}, []);
|
|
18614
18606
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
18615
|
-
var _a2, _b2, _c2
|
|
18607
|
+
var _a2, _b2, _c2;
|
|
18616
18608
|
const fc = fabricRef.current;
|
|
18617
18609
|
if (fc && isTransforming(fc)) {
|
|
18618
18610
|
return;
|
|
@@ -18996,7 +18988,7 @@ const PageCanvas = react.forwardRef(
|
|
|
18996
18988
|
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
18997
18989
|
const elementHeight = typeof element.height === "number" ? element.height : 0;
|
|
18998
18990
|
const heightBound = Math.max(elementHeight, minBoxHForShrink);
|
|
18999
|
-
|
|
18991
|
+
Math.max(1, text.split("\n").length);
|
|
19000
18992
|
while (fontSize > 1) {
|
|
19001
18993
|
const testTextbox = new fabric__namespace.Textbox(text, {
|
|
19002
18994
|
width: fixedWidth,
|
|
@@ -19010,11 +19002,9 @@ const PageCanvas = react.forwardRef(
|
|
|
19010
19002
|
});
|
|
19011
19003
|
testTextbox.initDimensions();
|
|
19012
19004
|
const textHeight = testTextbox.height || 0;
|
|
19013
|
-
const renderedLineCount = ((_c2 = testTextbox.textLines) == null ? void 0 : _c2.length) || 1;
|
|
19014
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
19015
19005
|
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
19016
19006
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
19017
|
-
if (
|
|
19007
|
+
if (fitsHeight && fitsWidth) {
|
|
19018
19008
|
break;
|
|
19019
19009
|
}
|
|
19020
19010
|
fontSize--;
|
|
@@ -19135,7 +19125,7 @@ const PageCanvas = react.forwardRef(
|
|
|
19135
19125
|
} catch {
|
|
19136
19126
|
}
|
|
19137
19127
|
obj.dirty = true;
|
|
19138
|
-
(
|
|
19128
|
+
(_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
|
|
19139
19129
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
19140
19130
|
c: element.textBgColor ?? null,
|
|
19141
19131
|
g: element.textBgGradient ?? null,
|
|
@@ -26452,9 +26442,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26452
26442
|
}
|
|
26453
26443
|
return svgString;
|
|
26454
26444
|
}
|
|
26455
|
-
const resolvedPackageVersion = "0.5.
|
|
26445
|
+
const resolvedPackageVersion = "0.5.491";
|
|
26456
26446
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26457
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26447
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.491";
|
|
26458
26448
|
const roundParityValue = (value) => {
|
|
26459
26449
|
if (typeof value !== "number") return value;
|
|
26460
26450
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27268,7 +27258,7 @@ class PixldocsRenderer {
|
|
|
27268
27258
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27269
27259
|
}
|
|
27270
27260
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27271
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27261
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BWUlBEaK.cjs"));
|
|
27272
27262
|
const prepared = preparePagesForExport(
|
|
27273
27263
|
cloned.pages,
|
|
27274
27264
|
canvasWidth,
|
|
@@ -29588,7 +29578,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29588
29578
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29589
29579
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29590
29580
|
try {
|
|
29591
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29581
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BWUlBEaK.cjs"));
|
|
29592
29582
|
try {
|
|
29593
29583
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29594
29584
|
} catch {
|
|
@@ -29902,4 +29892,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29902
29892
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29903
29893
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29904
29894
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29905
|
-
//# sourceMappingURL=index-
|
|
29895
|
+
//# sourceMappingURL=index-sfUNqu61.cjs.map
|