@pixldocs/canvas-renderer 0.5.73 → 0.5.74

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.cjs CHANGED
@@ -12550,7 +12550,7 @@ function PixldocsPreview(props) {
12550
12550
  !canvasSettled && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
12551
12551
  ] });
12552
12552
  }
12553
- const PACKAGE_VERSION = "0.5.73";
12553
+ const PACKAGE_VERSION = "0.5.74";
12554
12554
  let __underlineFixInstalled = false;
12555
12555
  function installUnderlineFix(fab) {
12556
12556
  var _a;
@@ -15630,13 +15630,13 @@ function drawPageBackground(pdf, pageIndex, pageWidth, pageHeight, backgroundCol
15630
15630
  }
15631
15631
  }
15632
15632
  async function assemblePdfFromSvgs(svgResults, options = {}) {
15633
- var _a, _b, _c;
15633
+ var _a, _b;
15634
15634
  if (svgResults.length === 0) throw new Error("No pages to export");
15635
15635
  const { title, stripPageBackground } = options;
15636
15636
  const firstPage = svgResults[0];
15637
15637
  const orientation = firstPage.width > firstPage.height ? "landscape" : "portrait";
15638
15638
  const PARITY_TAG = "[canvas-renderer][parity-diag][pkg-pdf]";
15639
- console.log(`${PARITY_TAG} pkg-version=0.5.71 pages=${svgResults.length}`);
15639
+ console.log(`${PARITY_TAG} pkg-version=0.5.74 pages=${svgResults.length}`);
15640
15640
  try {
15641
15641
  for (let pi = 0; pi < svgResults.length; pi++) {
15642
15642
  dumpSvgTextDiagnostics(svgResults[pi].svg, pi, PARITY_TAG, "STAGE-1-raw-toSVG");
@@ -15668,7 +15668,22 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
15668
15668
  drawPageBackground(pdf, i, page.width, page.height, page.backgroundColor, page.backgroundGradient);
15669
15669
  const shouldStripBg = stripPageBackground ?? hasGradient;
15670
15670
  const shouldOutlineText = options.outlineText !== false;
15671
- const pageSvg = page.svg;
15671
+ let pageSvg = page.svg;
15672
+ if (shouldOutlineText) {
15673
+ try {
15674
+ const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-BTHnqJpM.cjs"));
15675
+ pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl);
15676
+ try {
15677
+ dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");
15678
+ } catch {
15679
+ }
15680
+ } catch (outlineErr) {
15681
+ console.warn(
15682
+ "[canvas-renderer][pdf] raw-stage text outlining unavailable, falling back to embedded SVG text:",
15683
+ outlineErr
15684
+ );
15685
+ }
15686
+ }
15672
15687
  let processedSvg = await prepareLiveCanvasSvgForPdf(pageSvg, page.width, page.height, `page-${i + 1}`, {
15673
15688
  stripPageBackground: shouldStripBg
15674
15689
  });
@@ -15683,22 +15698,6 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
15683
15698
  } catch {
15684
15699
  }
15685
15700
  await convertTextDecorationsToLines(processedSvg);
15686
- if (shouldOutlineText) {
15687
- try {
15688
- const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-BTHnqJpM.cjs"));
15689
- const outlinedSvg = await convertAllTextToPath(
15690
- new XMLSerializer().serializeToString(processedSvg),
15691
- fontBaseUrl
15692
- );
15693
- const outlineDoc = new DOMParser().parseFromString(outlinedSvg, "image/svg+xml");
15694
- const outlinedRoot = outlineDoc.documentElement;
15695
- if (outlinedRoot && ((_c = outlinedRoot.tagName) == null ? void 0 : _c.toLowerCase()) === "svg" && !outlineDoc.querySelector("parsererror")) {
15696
- processedSvg = outlinedRoot;
15697
- }
15698
- } catch (outlineErr) {
15699
- console.warn("[canvas-renderer][pdf] text outlining unavailable, falling back to embedded SVG text:", outlineErr);
15700
- }
15701
- }
15702
15701
  const rewrittenSvg = rewriteSvgFontsForJsPDF(new XMLSerializer().serializeToString(processedSvg));
15703
15702
  const reParser = new DOMParser();
15704
15703
  const reDoc = reParser.parseFromString(rewrittenSvg, "image/svg+xml");