@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.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
@@ -12531,7 +12531,7 @@ function PixldocsPreview(props) {
12531
12531
  !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
12532
  ] });
12533
12533
  }
12534
- const PACKAGE_VERSION = "0.5.73";
12534
+ const PACKAGE_VERSION = "0.5.74";
12535
12535
  let __underlineFixInstalled = false;
12536
12536
  function installUnderlineFix(fab) {
12537
12537
  var _a;
@@ -15611,13 +15611,13 @@ function drawPageBackground(pdf, pageIndex, pageWidth, pageHeight, backgroundCol
15611
15611
  }
15612
15612
  }
15613
15613
  async function assemblePdfFromSvgs(svgResults, options = {}) {
15614
- var _a, _b, _c;
15614
+ var _a, _b;
15615
15615
  if (svgResults.length === 0) throw new Error("No pages to export");
15616
15616
  const { title, stripPageBackground } = options;
15617
15617
  const firstPage = svgResults[0];
15618
15618
  const orientation = firstPage.width > firstPage.height ? "landscape" : "portrait";
15619
15619
  const PARITY_TAG = "[canvas-renderer][parity-diag][pkg-pdf]";
15620
- console.log(`${PARITY_TAG} pkg-version=0.5.71 pages=${svgResults.length}`);
15620
+ console.log(`${PARITY_TAG} pkg-version=0.5.74 pages=${svgResults.length}`);
15621
15621
  try {
15622
15622
  for (let pi = 0; pi < svgResults.length; pi++) {
15623
15623
  dumpSvgTextDiagnostics(svgResults[pi].svg, pi, PARITY_TAG, "STAGE-1-raw-toSVG");
@@ -15649,7 +15649,22 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
15649
15649
  drawPageBackground(pdf, i, page.width, page.height, page.backgroundColor, page.backgroundGradient);
15650
15650
  const shouldStripBg = stripPageBackground ?? hasGradient;
15651
15651
  const shouldOutlineText = options.outlineText !== false;
15652
- const pageSvg = page.svg;
15652
+ let pageSvg = page.svg;
15653
+ if (shouldOutlineText) {
15654
+ try {
15655
+ const { convertAllTextToPath } = await import("./svgTextToPath-BP0Kppla.js");
15656
+ pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl);
15657
+ try {
15658
+ dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");
15659
+ } catch {
15660
+ }
15661
+ } catch (outlineErr) {
15662
+ console.warn(
15663
+ "[canvas-renderer][pdf] raw-stage text outlining unavailable, falling back to embedded SVG text:",
15664
+ outlineErr
15665
+ );
15666
+ }
15667
+ }
15653
15668
  let processedSvg = await prepareLiveCanvasSvgForPdf(pageSvg, page.width, page.height, `page-${i + 1}`, {
15654
15669
  stripPageBackground: shouldStripBg
15655
15670
  });
@@ -15664,22 +15679,6 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
15664
15679
  } catch {
15665
15680
  }
15666
15681
  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
15682
  const rewrittenSvg = rewriteSvgFontsForJsPDF(new XMLSerializer().serializeToString(processedSvg));
15684
15683
  const reParser = new DOMParser();
15685
15684
  const reDoc = reParser.parseFromString(rewrittenSvg, "image/svg+xml");