@pixldocs/canvas-renderer 0.5.78 → 0.5.79
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 +28 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12597,7 +12597,7 @@ function PixldocsPreview(props) {
|
|
|
12597
12597
|
!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..." }) })
|
|
12598
12598
|
] });
|
|
12599
12599
|
}
|
|
12600
|
-
const PACKAGE_VERSION = "0.5.
|
|
12600
|
+
const PACKAGE_VERSION = "0.5.79";
|
|
12601
12601
|
const roundParityValue = (value) => {
|
|
12602
12602
|
if (typeof value !== "number") return value;
|
|
12603
12603
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -15507,6 +15507,25 @@ async function convertTextDecorationsToLines(svg) {
|
|
|
15507
15507
|
}
|
|
15508
15508
|
}
|
|
15509
15509
|
}
|
|
15510
|
+
async function convertSvgTextDecorationsToLinesString(svgStr) {
|
|
15511
|
+
if (typeof DOMParser === "undefined" || typeof XMLSerializer === "undefined") {
|
|
15512
|
+
return svgStr;
|
|
15513
|
+
}
|
|
15514
|
+
if (!/text-decoration/i.test(svgStr) && !/underline/i.test(svgStr)) {
|
|
15515
|
+
return svgStr;
|
|
15516
|
+
}
|
|
15517
|
+
try {
|
|
15518
|
+
const parser = new DOMParser();
|
|
15519
|
+
const docEl = parser.parseFromString(svgStr, "image/svg+xml");
|
|
15520
|
+
const rootSvg = docEl.documentElement;
|
|
15521
|
+
if (!rootSvg) return svgStr;
|
|
15522
|
+
await convertTextDecorationsToLines(rootSvg);
|
|
15523
|
+
const serializer = new XMLSerializer();
|
|
15524
|
+
return serializer.serializeToString(rootSvg);
|
|
15525
|
+
} catch {
|
|
15526
|
+
return svgStr;
|
|
15527
|
+
}
|
|
15528
|
+
}
|
|
15510
15529
|
async function rasterizeShadowMarkers(svg) {
|
|
15511
15530
|
var _a, _b, _c, _d, _e;
|
|
15512
15531
|
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
@@ -15775,6 +15794,14 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
15775
15794
|
const shouldStripBg = stripPageBackground ?? hasGradient;
|
|
15776
15795
|
const shouldOutlineText = options.outlineText !== false;
|
|
15777
15796
|
let pageSvg = page.svg;
|
|
15797
|
+
try {
|
|
15798
|
+
pageSvg = await convertSvgTextDecorationsToLinesString(pageSvg);
|
|
15799
|
+
} catch (underlineErr) {
|
|
15800
|
+
console.warn(
|
|
15801
|
+
"[canvas-renderer][pdf] underline-to-line conversion failed (raw stage):",
|
|
15802
|
+
underlineErr
|
|
15803
|
+
);
|
|
15804
|
+
}
|
|
15778
15805
|
if (shouldOutlineText) {
|
|
15779
15806
|
try {
|
|
15780
15807
|
const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-BTHnqJpM.cjs"));
|