@pixldocs/canvas-renderer 0.5.168 → 0.5.170

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.
@@ -6356,6 +6356,8 @@ function createText(element) {
6356
6356
  const fixedWidth = Math.max(baseWidth, 1);
6357
6357
  const splitByGrapheme = overflowPolicy === "auto-shrink" ? false : element.splitByGrapheme ?? element.wordWrap === "break-word";
6358
6358
  if (overflowPolicy === "auto-shrink") {
6359
+ const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
6360
+ const heightBound = Math.max(baseHeight || 0, minBoxHForShrink);
6359
6361
  const explicitLineCount = Math.max(1, text.split("\n").length);
6360
6362
  const debugAutoShrink = typeof window !== "undefined" && window.__pixldocsDebugAutoShrink === true;
6361
6363
  const startFontSize = fontSize;
@@ -6378,7 +6380,7 @@ function createText(element) {
6378
6380
  const textHeight = testTextbox.height || 0;
6379
6381
  const renderedLineCount = ((_a = testTextbox.textLines) == null ? void 0 : _a.length) || 1;
6380
6382
  const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
6381
- const fitsHeight = !baseHeight || textHeight <= baseHeight;
6383
+ const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
6382
6384
  const widthMetrics = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
6383
6385
  const { maxLineWidth, widthDidGrow, fitsWidth } = widthMetrics;
6384
6386
  if (debugAutoShrink) {
@@ -15750,6 +15752,20 @@ function paintRepeatableSections(config, repeatableSections) {
15750
15752
  }
15751
15753
  }
15752
15754
  const PREVIEW_DEBUG_PREFIX = "[canvas-renderer][preview-debug]";
15755
+ function computeFontSignature(config) {
15756
+ var _a;
15757
+ if (!((_a = config == null ? void 0 : config.pages) == null ? void 0 : _a.length)) return "";
15758
+ const fams = /* @__PURE__ */ new Set();
15759
+ const walk = (nodes) => {
15760
+ var _a2;
15761
+ for (const node of nodes || []) {
15762
+ if (node == null ? void 0 : node.fontFamily) fams.add(String(node.fontFamily));
15763
+ if ((_a2 = node == null ? void 0 : node.children) == null ? void 0 : _a2.length) walk(node.children);
15764
+ }
15765
+ };
15766
+ for (const page of config.pages) walk(page.children || []);
15767
+ return Array.from(fams).sort().join("|");
15768
+ }
15753
15769
  function countUnderlinedNodes(config) {
15754
15770
  var _a;
15755
15771
  if (!((_a = config == null ? void 0 : config.pages) == null ? void 0 : _a.length)) return 0;
@@ -15868,6 +15884,7 @@ function PixldocsPreview(props) {
15868
15884
  ]);
15869
15885
  const config = isResolveMode ? resolvedConfig : props.config;
15870
15886
  const previewKey = useMemo(() => `${pageIndex}`, [pageIndex]);
15887
+ const fontSignature = useMemo(() => computeFontSignature(config), [config]);
15871
15888
  useEffect(() => {
15872
15889
  if (isResolveMode) return;
15873
15890
  if (!config) {
@@ -15897,7 +15914,7 @@ function PixldocsPreview(props) {
15897
15914
  return () => {
15898
15915
  cancelled = true;
15899
15916
  };
15900
- }, [isResolveMode, config]);
15917
+ }, [isResolveMode, fontSignature]);
15901
15918
  const handleCanvasReady = useCallback(() => {
15902
15919
  console.log(PREVIEW_DEBUG_PREFIX, "canvas-ready", { pageIndex, action: "settled" });
15903
15920
  setCanvasSettled(true);
@@ -16100,9 +16117,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
16100
16117
  }
16101
16118
  return svgString;
16102
16119
  }
16103
- const resolvedPackageVersion = "0.5.168";
16120
+ const resolvedPackageVersion = "0.5.170";
16104
16121
  const PACKAGE_VERSION = resolvedPackageVersion;
16105
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.168";
16122
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.170";
16106
16123
  const roundParityValue = (value) => {
16107
16124
  if (typeof value !== "number") return value;
16108
16125
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -16600,7 +16617,7 @@ class PixldocsRenderer {
16600
16617
  await this.waitForCanvasScene(container, cloned, i);
16601
16618
  }
16602
16619
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16603
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DCy1uYUF.js");
16620
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BD0zlq42.js");
16604
16621
  const prepared = preparePagesForExport(
16605
16622
  cloned.pages,
16606
16623
  canvasWidth,
@@ -18702,7 +18719,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18702
18719
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18703
18720
  sanitizeSvgTreeForPdf(svgToDraw);
18704
18721
  try {
18705
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DCy1uYUF.js");
18722
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BD0zlq42.js");
18706
18723
  try {
18707
18724
  await logTextMeasurementDiagnostic(svgToDraw);
18708
18725
  } catch {
@@ -19104,4 +19121,4 @@ export {
19104
19121
  collectFontDescriptorsFromConfig as y,
19105
19122
  collectFontsFromConfig as z
19106
19123
  };
19107
- //# sourceMappingURL=index-oFnROAcT.js.map
19124
+ //# sourceMappingURL=index-BvYxWljO.js.map