@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.
@@ -534,7 +534,6 @@ function getCacheKey(element) {
534
534
  });
535
535
  }
536
536
  function measureTextHeight(element) {
537
- var _a2;
538
537
  if (element.type !== "text") {
539
538
  return element.height || 20;
540
539
  }
@@ -567,11 +566,9 @@ function measureTextHeight(element) {
567
566
  });
568
567
  testTb.initDimensions();
569
568
  const textHeight = testTb.height || 0;
570
- const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
571
- const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
572
569
  const fitsHeight = !baseHeight || textHeight <= baseHeight;
573
570
  const { fitsWidth } = getTextboxWidthFitMetrics(testTb, measureWidth);
574
- if (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
571
+ if (fitsHeight && fitsWidth) break;
575
572
  fontSize--;
576
573
  }
577
574
  const finalTb = new fabric.Textbox(textToMeasure, {
@@ -639,7 +636,6 @@ function clearMeasurementCache() {
639
636
  heightCache.clear();
640
637
  }
641
638
  function computeAutoShrinkFontSize(element) {
642
- var _a2;
643
639
  const baseFontSize = element.fontSize || 16;
644
640
  if (element.overflowPolicy !== "auto-shrink") return baseFontSize;
645
641
  const text = element.text || element.content || "";
@@ -663,13 +659,11 @@ function computeAutoShrinkFontSize(element) {
663
659
  });
664
660
  testTb.initDimensions();
665
661
  const textHeight = testTb.height || 0;
666
- const renderedLineCount = ((_a2 = testTb.textLines) == null ? void 0 : _a2.length) || 1;
667
- const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
668
662
  const fitsHeight = textHeight <= height;
669
663
  const lineWidths = testTb.__lineWidths;
670
664
  const maxLineWidth = lineWidths && lineWidths.length > 0 ? Math.max(...lineWidths) : 0;
671
665
  const fitsWidth = maxLineWidth <= width + 1;
672
- if (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
666
+ if (fitsHeight && fitsWidth) break;
673
667
  fontSize--;
674
668
  }
675
669
  } catch (e) {
@@ -9879,7 +9873,7 @@ function createText(element) {
9879
9873
  iterationSamples.push(lastIter);
9880
9874
  }
9881
9875
  }
9882
- if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
9876
+ if (fitsHeight && fitsWidth) {
9883
9877
  breakReason = "fits";
9884
9878
  break;
9885
9879
  }
@@ -18594,7 +18588,7 @@ const PageCanvas = forwardRef(
18594
18588
  return unsub;
18595
18589
  }, []);
18596
18590
  const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
18597
- var _a2, _b2, _c2, _d;
18591
+ var _a2, _b2, _c2;
18598
18592
  const fc = fabricRef.current;
18599
18593
  if (fc && isTransforming(fc)) {
18600
18594
  return;
@@ -18978,7 +18972,7 @@ const PageCanvas = forwardRef(
18978
18972
  const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
18979
18973
  const elementHeight = typeof element.height === "number" ? element.height : 0;
18980
18974
  const heightBound = Math.max(elementHeight, minBoxHForShrink);
18981
- const explicitLineCount = Math.max(1, text.split("\n").length);
18975
+ Math.max(1, text.split("\n").length);
18982
18976
  while (fontSize > 1) {
18983
18977
  const testTextbox = new fabric.Textbox(text, {
18984
18978
  width: fixedWidth,
@@ -18992,11 +18986,9 @@ const PageCanvas = forwardRef(
18992
18986
  });
18993
18987
  testTextbox.initDimensions();
18994
18988
  const textHeight = testTextbox.height || 0;
18995
- const renderedLineCount = ((_c2 = testTextbox.textLines) == null ? void 0 : _c2.length) || 1;
18996
- const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
18997
18989
  const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
18998
18990
  const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
18999
- if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
18991
+ if (fitsHeight && fitsWidth) {
19000
18992
  break;
19001
18993
  }
19002
18994
  fontSize--;
@@ -19117,7 +19109,7 @@ const PageCanvas = forwardRef(
19117
19109
  } catch {
19118
19110
  }
19119
19111
  obj.dirty = true;
19120
- (_d = obj.setCoords) == null ? void 0 : _d.call(obj);
19112
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
19121
19113
  obj.__lastTextBgShadowJson = JSON.stringify({
19122
19114
  c: element.textBgColor ?? null,
19123
19115
  g: element.textBgGradient ?? null,
@@ -26434,9 +26426,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26434
26426
  }
26435
26427
  return svgString;
26436
26428
  }
26437
- const resolvedPackageVersion = "0.5.489";
26429
+ const resolvedPackageVersion = "0.5.490";
26438
26430
  const PACKAGE_VERSION = resolvedPackageVersion;
26439
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.489";
26431
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.490";
26440
26432
  const roundParityValue = (value) => {
26441
26433
  if (typeof value !== "number") return value;
26442
26434
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27250,7 +27242,7 @@ class PixldocsRenderer {
27250
27242
  await this.waitForCanvasScene(container, cloned, i);
27251
27243
  }
27252
27244
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27253
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-zW2ceM2y.js");
27245
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-f828EcQ6.js");
27254
27246
  const prepared = preparePagesForExport(
27255
27247
  cloned.pages,
27256
27248
  canvasWidth,
@@ -29570,7 +29562,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29570
29562
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29571
29563
  sanitizeSvgTreeForPdf(svgToDraw);
29572
29564
  try {
29573
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-zW2ceM2y.js");
29565
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-f828EcQ6.js");
29574
29566
  try {
29575
29567
  await logTextMeasurementDiagnostic(svgToDraw);
29576
29568
  } catch {
@@ -29887,4 +29879,4 @@ export {
29887
29879
  buildTeaserBlurFlatKeys as y,
29888
29880
  collectFontDescriptorsFromConfig as z
29889
29881
  };
29890
- //# sourceMappingURL=index-DFPaf9mH.js.map
29882
+ //# sourceMappingURL=index-xazc-CdA.js.map