@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.cjs +23 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10616,7 +10616,10 @@ function setInTree(nodes, elementId, targetProperty, value) {
|
|
|
10616
10616
|
node[targetProperty] = value;
|
|
10617
10617
|
}
|
|
10618
10618
|
if (targetProperty === "text" && node.type === "text") {
|
|
10619
|
-
|
|
10619
|
+
const overflowPolicy = String(node.overflowPolicy ?? "grow-and-push");
|
|
10620
|
+
if (overflowPolicy !== "auto-shrink") {
|
|
10621
|
+
delete node.height;
|
|
10622
|
+
}
|
|
10620
10623
|
}
|
|
10621
10624
|
if ((targetProperty === "src" || targetProperty === "imageUrl") && node.type === "image") {
|
|
10622
10625
|
delete node.imageNaturalWidth;
|
|
@@ -12550,7 +12553,7 @@ function PixldocsPreview(props) {
|
|
|
12550
12553
|
!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
12554
|
] });
|
|
12552
12555
|
}
|
|
12553
|
-
const PACKAGE_VERSION = "0.5.
|
|
12556
|
+
const PACKAGE_VERSION = "0.5.74";
|
|
12554
12557
|
let __underlineFixInstalled = false;
|
|
12555
12558
|
function installUnderlineFix(fab) {
|
|
12556
12559
|
var _a;
|
|
@@ -15630,13 +15633,13 @@ function drawPageBackground(pdf, pageIndex, pageWidth, pageHeight, backgroundCol
|
|
|
15630
15633
|
}
|
|
15631
15634
|
}
|
|
15632
15635
|
async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
15633
|
-
var _a, _b
|
|
15636
|
+
var _a, _b;
|
|
15634
15637
|
if (svgResults.length === 0) throw new Error("No pages to export");
|
|
15635
15638
|
const { title, stripPageBackground } = options;
|
|
15636
15639
|
const firstPage = svgResults[0];
|
|
15637
15640
|
const orientation = firstPage.width > firstPage.height ? "landscape" : "portrait";
|
|
15638
15641
|
const PARITY_TAG = "[canvas-renderer][parity-diag][pkg-pdf]";
|
|
15639
|
-
console.log(`${PARITY_TAG} pkg-version=0.5.
|
|
15642
|
+
console.log(`${PARITY_TAG} pkg-version=0.5.74 pages=${svgResults.length}`);
|
|
15640
15643
|
try {
|
|
15641
15644
|
for (let pi = 0; pi < svgResults.length; pi++) {
|
|
15642
15645
|
dumpSvgTextDiagnostics(svgResults[pi].svg, pi, PARITY_TAG, "STAGE-1-raw-toSVG");
|
|
@@ -15668,7 +15671,22 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
15668
15671
|
drawPageBackground(pdf, i, page.width, page.height, page.backgroundColor, page.backgroundGradient);
|
|
15669
15672
|
const shouldStripBg = stripPageBackground ?? hasGradient;
|
|
15670
15673
|
const shouldOutlineText = options.outlineText !== false;
|
|
15671
|
-
|
|
15674
|
+
let pageSvg = page.svg;
|
|
15675
|
+
if (shouldOutlineText) {
|
|
15676
|
+
try {
|
|
15677
|
+
const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-BTHnqJpM.cjs"));
|
|
15678
|
+
pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl);
|
|
15679
|
+
try {
|
|
15680
|
+
dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");
|
|
15681
|
+
} catch {
|
|
15682
|
+
}
|
|
15683
|
+
} catch (outlineErr) {
|
|
15684
|
+
console.warn(
|
|
15685
|
+
"[canvas-renderer][pdf] raw-stage text outlining unavailable, falling back to embedded SVG text:",
|
|
15686
|
+
outlineErr
|
|
15687
|
+
);
|
|
15688
|
+
}
|
|
15689
|
+
}
|
|
15672
15690
|
let processedSvg = await prepareLiveCanvasSvgForPdf(pageSvg, page.width, page.height, `page-${i + 1}`, {
|
|
15673
15691
|
stripPageBackground: shouldStripBg
|
|
15674
15692
|
});
|
|
@@ -15683,22 +15701,6 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
15683
15701
|
} catch {
|
|
15684
15702
|
}
|
|
15685
15703
|
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
15704
|
const rewrittenSvg = rewriteSvgFontsForJsPDF(new XMLSerializer().serializeToString(processedSvg));
|
|
15703
15705
|
const reParser = new DOMParser();
|
|
15704
15706
|
const reDoc = reParser.parseFromString(rewrittenSvg, "image/svg+xml");
|