@pixldocs/canvas-renderer 0.5.136 → 0.5.138

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.
@@ -15939,7 +15939,7 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
15939
15939
  }
15940
15940
  return svgString;
15941
15941
  }
15942
- const PACKAGE_VERSION = "0.5.136";
15942
+ const PACKAGE_VERSION = "0.5.138";
15943
15943
  const roundParityValue = (value) => {
15944
15944
  if (typeof value !== "number") return value;
15945
15945
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -15960,6 +15960,12 @@ function logJsonLine(tag, payload) {
15960
15960
  console.log(tag, payload);
15961
15961
  }
15962
15962
  }
15963
+ function isFabricTextboxLike(obj) {
15964
+ return !!obj && (obj instanceof fabric.Textbox || obj.type === "textbox" || obj.type === "text" || typeof obj.getLineWidth === "function" && Array.isArray(obj._textLines));
15965
+ }
15966
+ function isFabricGroupLike(obj) {
15967
+ return !!obj && (obj instanceof fabric.Group || obj.type === "group" || Array.isArray(obj._objects) && typeof obj.getObjects === "function");
15968
+ }
15963
15969
  let __underlineFixInstalled = false;
15964
15970
  function installUnderlineFix(fab) {
15965
15971
  var _a;
@@ -16358,7 +16364,7 @@ class PixldocsRenderer {
16358
16364
  await this.waitForCanvasScene(container, cloned, i);
16359
16365
  }
16360
16366
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16361
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-D3L64sAJ.js");
16367
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BGqNP_R0.js");
16362
16368
  const prepared = preparePagesForExport(
16363
16369
  cloned.pages,
16364
16370
  canvasWidth,
@@ -16934,7 +16940,7 @@ class PixldocsRenderer {
16934
16940
  const visit = (obj, groupPath = "") => {
16935
16941
  var _a2;
16936
16942
  if (!obj) return;
16937
- if (obj instanceof fabric.Textbox) {
16943
+ if (isFabricTextboxLike(obj)) {
16938
16944
  const lineWidths = getCanvasMeasuredTextboxLineWidths(obj);
16939
16945
  sample.push({
16940
16946
  id: getObjectId(obj),
@@ -16975,6 +16981,12 @@ class PixldocsRenderer {
16975
16981
  const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
16976
16982
  const primeCharBounds = (obj) => {
16977
16983
  if (obj instanceof fabric.Textbox) {
16984
+ try {
16985
+ obj.__lineWidths = [];
16986
+ obj.__lineHeights = [];
16987
+ obj.__charBounds = [];
16988
+ } catch {
16989
+ }
16978
16990
  const lines = obj._textLines;
16979
16991
  if (Array.isArray(lines)) {
16980
16992
  for (let i = 0; i < lines.length; i++) {
@@ -16987,7 +16999,7 @@ class PixldocsRenderer {
16987
16999
  obj.dirty = true;
16988
17000
  return;
16989
17001
  }
16990
- if (obj instanceof fabric.Group) {
17002
+ if (isFabricGroupLike(obj)) {
16991
17003
  obj.getObjects().forEach(primeCharBounds);
16992
17004
  obj.dirty = true;
16993
17005
  }
@@ -18450,7 +18462,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18450
18462
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18451
18463
  sanitizeSvgTreeForPdf(svgToDraw);
18452
18464
  try {
18453
- const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-D3L64sAJ.js");
18465
+ const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-BGqNP_R0.js");
18454
18466
  await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
18455
18467
  } catch (e) {
18456
18468
  console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
@@ -18795,4 +18807,4 @@ export {
18795
18807
  collectFontDescriptorsFromConfig as y,
18796
18808
  collectFontsFromConfig as z
18797
18809
  };
18798
- //# sourceMappingURL=index-BHa3ekoF.js.map
18810
+ //# sourceMappingURL=index-D-I6bYGU.js.map