@pixldocs/canvas-renderer 0.5.73 → 0.5.75

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.d.ts CHANGED
@@ -256,7 +256,7 @@ export declare function normalizeFontFamily(fontStack: string): string;
256
256
  * Package version banner. Bump alongside package.json so we can confirm
257
257
  * (via browser:log) that the deployed bundle matches the expected build.
258
258
  */
259
- export declare const PACKAGE_VERSION = "0.5.73";
259
+ export declare const PACKAGE_VERSION = "0.5.74";
260
260
 
261
261
  export declare interface PageSettings {
262
262
  backgroundColor?: string;
package/dist/index.js CHANGED
@@ -10597,7 +10597,10 @@ function setInTree(nodes, elementId, targetProperty, value) {
10597
10597
  node[targetProperty] = value;
10598
10598
  }
10599
10599
  if (targetProperty === "text" && node.type === "text") {
10600
- delete node.height;
10600
+ const overflowPolicy = String(node.overflowPolicy ?? "grow-and-push");
10601
+ if (overflowPolicy !== "auto-shrink") {
10602
+ delete node.height;
10603
+ }
10601
10604
  }
10602
10605
  if ((targetProperty === "src" || targetProperty === "imageUrl") && node.type === "image") {
10603
10606
  delete node.imageNaturalWidth;
@@ -12531,7 +12534,7 @@ function PixldocsPreview(props) {
12531
12534
  !canvasSettled && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
12532
12535
  ] });
12533
12536
  }
12534
- const PACKAGE_VERSION = "0.5.73";
12537
+ const PACKAGE_VERSION = "0.5.74";
12535
12538
  let __underlineFixInstalled = false;
12536
12539
  function installUnderlineFix(fab) {
12537
12540
  var _a;
@@ -15611,13 +15614,13 @@ function drawPageBackground(pdf, pageIndex, pageWidth, pageHeight, backgroundCol
15611
15614
  }
15612
15615
  }
15613
15616
  async function assemblePdfFromSvgs(svgResults, options = {}) {
15614
- var _a, _b, _c;
15617
+ var _a, _b;
15615
15618
  if (svgResults.length === 0) throw new Error("No pages to export");
15616
15619
  const { title, stripPageBackground } = options;
15617
15620
  const firstPage = svgResults[0];
15618
15621
  const orientation = firstPage.width > firstPage.height ? "landscape" : "portrait";
15619
15622
  const PARITY_TAG = "[canvas-renderer][parity-diag][pkg-pdf]";
15620
- console.log(`${PARITY_TAG} pkg-version=0.5.71 pages=${svgResults.length}`);
15623
+ console.log(`${PARITY_TAG} pkg-version=0.5.74 pages=${svgResults.length}`);
15621
15624
  try {
15622
15625
  for (let pi = 0; pi < svgResults.length; pi++) {
15623
15626
  dumpSvgTextDiagnostics(svgResults[pi].svg, pi, PARITY_TAG, "STAGE-1-raw-toSVG");
@@ -15649,7 +15652,22 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
15649
15652
  drawPageBackground(pdf, i, page.width, page.height, page.backgroundColor, page.backgroundGradient);
15650
15653
  const shouldStripBg = stripPageBackground ?? hasGradient;
15651
15654
  const shouldOutlineText = options.outlineText !== false;
15652
- const pageSvg = page.svg;
15655
+ let pageSvg = page.svg;
15656
+ if (shouldOutlineText) {
15657
+ try {
15658
+ const { convertAllTextToPath } = await import("./svgTextToPath-BP0Kppla.js");
15659
+ pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl);
15660
+ try {
15661
+ dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");
15662
+ } catch {
15663
+ }
15664
+ } catch (outlineErr) {
15665
+ console.warn(
15666
+ "[canvas-renderer][pdf] raw-stage text outlining unavailable, falling back to embedded SVG text:",
15667
+ outlineErr
15668
+ );
15669
+ }
15670
+ }
15653
15671
  let processedSvg = await prepareLiveCanvasSvgForPdf(pageSvg, page.width, page.height, `page-${i + 1}`, {
15654
15672
  stripPageBackground: shouldStripBg
15655
15673
  });
@@ -15664,22 +15682,6 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
15664
15682
  } catch {
15665
15683
  }
15666
15684
  await convertTextDecorationsToLines(processedSvg);
15667
- if (shouldOutlineText) {
15668
- try {
15669
- const { convertAllTextToPath } = await import("./svgTextToPath-BP0Kppla.js");
15670
- const outlinedSvg = await convertAllTextToPath(
15671
- new XMLSerializer().serializeToString(processedSvg),
15672
- fontBaseUrl
15673
- );
15674
- const outlineDoc = new DOMParser().parseFromString(outlinedSvg, "image/svg+xml");
15675
- const outlinedRoot = outlineDoc.documentElement;
15676
- if (outlinedRoot && ((_c = outlinedRoot.tagName) == null ? void 0 : _c.toLowerCase()) === "svg" && !outlineDoc.querySelector("parsererror")) {
15677
- processedSvg = outlinedRoot;
15678
- }
15679
- } catch (outlineErr) {
15680
- console.warn("[canvas-renderer][pdf] text outlining unavailable, falling back to embedded SVG text:", outlineErr);
15681
- }
15682
- }
15683
15685
  const rewrittenSvg = rewriteSvgFontsForJsPDF(new XMLSerializer().serializeToString(processedSvg));
15684
15686
  const reParser = new DOMParser();
15685
15687
  const reDoc = reParser.parseFromString(rewrittenSvg, "image/svg+xml");