@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.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.
|
|
259
|
+
export declare const PACKAGE_VERSION = "0.5.79";
|
|
260
260
|
|
|
261
261
|
export declare interface PageSettings {
|
|
262
262
|
backgroundColor?: string;
|
package/dist/index.js
CHANGED
|
@@ -12578,7 +12578,7 @@ function PixldocsPreview(props) {
|
|
|
12578
12578
|
!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..." }) })
|
|
12579
12579
|
] });
|
|
12580
12580
|
}
|
|
12581
|
-
const PACKAGE_VERSION = "0.5.
|
|
12581
|
+
const PACKAGE_VERSION = "0.5.79";
|
|
12582
12582
|
const roundParityValue = (value) => {
|
|
12583
12583
|
if (typeof value !== "number") return value;
|
|
12584
12584
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -15488,6 +15488,25 @@ async function convertTextDecorationsToLines(svg) {
|
|
|
15488
15488
|
}
|
|
15489
15489
|
}
|
|
15490
15490
|
}
|
|
15491
|
+
async function convertSvgTextDecorationsToLinesString(svgStr) {
|
|
15492
|
+
if (typeof DOMParser === "undefined" || typeof XMLSerializer === "undefined") {
|
|
15493
|
+
return svgStr;
|
|
15494
|
+
}
|
|
15495
|
+
if (!/text-decoration/i.test(svgStr) && !/underline/i.test(svgStr)) {
|
|
15496
|
+
return svgStr;
|
|
15497
|
+
}
|
|
15498
|
+
try {
|
|
15499
|
+
const parser = new DOMParser();
|
|
15500
|
+
const docEl = parser.parseFromString(svgStr, "image/svg+xml");
|
|
15501
|
+
const rootSvg = docEl.documentElement;
|
|
15502
|
+
if (!rootSvg) return svgStr;
|
|
15503
|
+
await convertTextDecorationsToLines(rootSvg);
|
|
15504
|
+
const serializer = new XMLSerializer();
|
|
15505
|
+
return serializer.serializeToString(rootSvg);
|
|
15506
|
+
} catch {
|
|
15507
|
+
return svgStr;
|
|
15508
|
+
}
|
|
15509
|
+
}
|
|
15491
15510
|
async function rasterizeShadowMarkers(svg) {
|
|
15492
15511
|
var _a, _b, _c, _d, _e;
|
|
15493
15512
|
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
@@ -15756,6 +15775,14 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
15756
15775
|
const shouldStripBg = stripPageBackground ?? hasGradient;
|
|
15757
15776
|
const shouldOutlineText = options.outlineText !== false;
|
|
15758
15777
|
let pageSvg = page.svg;
|
|
15778
|
+
try {
|
|
15779
|
+
pageSvg = await convertSvgTextDecorationsToLinesString(pageSvg);
|
|
15780
|
+
} catch (underlineErr) {
|
|
15781
|
+
console.warn(
|
|
15782
|
+
"[canvas-renderer][pdf] underline-to-line conversion failed (raw stage):",
|
|
15783
|
+
underlineErr
|
|
15784
|
+
);
|
|
15785
|
+
}
|
|
15759
15786
|
if (shouldOutlineText) {
|
|
15760
15787
|
try {
|
|
15761
15788
|
const { convertAllTextToPath } = await import("./svgTextToPath-BP0Kppla.js");
|