@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.
@@ -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 (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
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 (hasNoImplicitWrap && fitsHeight && fitsWidth) break;
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 (hasNoImplicitWrap && fitsHeight && fitsWidth) {
9894
+ if (fitsHeight && fitsWidth) {
9901
9895
  breakReason = "fits";
9902
9896
  break;
9903
9897
  }
@@ -18612,7 +18606,7 @@ const PageCanvas = react.forwardRef(
18612
18606
  return unsub;
18613
18607
  }, []);
18614
18608
  const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
18615
- var _a2, _b2, _c2, _d;
18609
+ var _a2, _b2, _c2;
18616
18610
  const fc = fabricRef.current;
18617
18611
  if (fc && isTransforming(fc)) {
18618
18612
  return;
@@ -18996,7 +18990,7 @@ const PageCanvas = react.forwardRef(
18996
18990
  const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
18997
18991
  const elementHeight = typeof element.height === "number" ? element.height : 0;
18998
18992
  const heightBound = Math.max(elementHeight, minBoxHForShrink);
18999
- const explicitLineCount = Math.max(1, text.split("\n").length);
18993
+ Math.max(1, text.split("\n").length);
19000
18994
  while (fontSize > 1) {
19001
18995
  const testTextbox = new fabric__namespace.Textbox(text, {
19002
18996
  width: fixedWidth,
@@ -19010,11 +19004,9 @@ const PageCanvas = react.forwardRef(
19010
19004
  });
19011
19005
  testTextbox.initDimensions();
19012
19006
  const textHeight = testTextbox.height || 0;
19013
- const renderedLineCount = ((_c2 = testTextbox.textLines) == null ? void 0 : _c2.length) || 1;
19014
- const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
19015
19007
  const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
19016
19008
  const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
19017
- if (hasNoImplicitWrap && fitsHeight && fitsWidth) {
19009
+ if (fitsHeight && fitsWidth) {
19018
19010
  break;
19019
19011
  }
19020
19012
  fontSize--;
@@ -19135,7 +19127,7 @@ const PageCanvas = react.forwardRef(
19135
19127
  } catch {
19136
19128
  }
19137
19129
  obj.dirty = true;
19138
- (_d = obj.setCoords) == null ? void 0 : _d.call(obj);
19130
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
19139
19131
  obj.__lastTextBgShadowJson = JSON.stringify({
19140
19132
  c: element.textBgColor ?? null,
19141
19133
  g: element.textBgGradient ?? null,
@@ -26452,9 +26444,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26452
26444
  }
26453
26445
  return svgString;
26454
26446
  }
26455
- const resolvedPackageVersion = "0.5.489";
26447
+ const resolvedPackageVersion = "0.5.490";
26456
26448
  const PACKAGE_VERSION = resolvedPackageVersion;
26457
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.489";
26449
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.490";
26458
26450
  const roundParityValue = (value) => {
26459
26451
  if (typeof value !== "number") return value;
26460
26452
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27268,7 +27260,7 @@ class PixldocsRenderer {
27268
27260
  await this.waitForCanvasScene(container, cloned, i);
27269
27261
  }
27270
27262
  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-c8OVQAkW.cjs"));
27263
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-mxgjzQsw.cjs"));
27272
27264
  const prepared = preparePagesForExport(
27273
27265
  cloned.pages,
27274
27266
  canvasWidth,
@@ -29588,7 +29580,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29588
29580
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29589
29581
  sanitizeSvgTreeForPdf(svgToDraw);
29590
29582
  try {
29591
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-c8OVQAkW.cjs"));
29583
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-mxgjzQsw.cjs"));
29592
29584
  try {
29593
29585
  await logTextMeasurementDiagnostic(svgToDraw);
29594
29586
  } catch {
@@ -29902,4 +29894,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29902
29894
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29903
29895
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29904
29896
  exports.warmTemplateFromForm = warmTemplateFromForm;
29905
- //# sourceMappingURL=index-SOZMTq-v.cjs.map
29897
+ //# sourceMappingURL=index-C47g5w5y.cjs.map