@pixldocs/canvas-renderer 0.5.134 → 0.5.135
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-DmqoeVsF.cjs → index-BCvB875s.cjs} +26 -5
- package/dist/{index-DmqoeVsF.cjs.map → index-BCvB875s.cjs.map} +1 -1
- package/dist/{index-Sc4qRn5o.js → index-WM3oV4wa.js} +26 -5
- package/dist/{index-Sc4qRn5o.js.map → index-WM3oV4wa.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BA6bhLs-.js → vectorPdfExport-CyHRXea-.js} +4 -4
- package/dist/{vectorPdfExport-BA6bhLs-.js.map → vectorPdfExport-CyHRXea-.js.map} +1 -1
- package/dist/{vectorPdfExport-8Q3O7Z_Q.cjs → vectorPdfExport-DFgDiZck.cjs} +4 -4
- package/dist/{vectorPdfExport-8Q3O7Z_Q.cjs.map → vectorPdfExport-DFgDiZck.cjs.map} +1 -1
- package/package.json +1 -1
|
@@ -14615,6 +14615,26 @@ function normalizeFontFamily(fontStack) {
|
|
|
14615
14615
|
const loadedFonts = /* @__PURE__ */ new Set();
|
|
14616
14616
|
const loadingPromises = /* @__PURE__ */ new Map();
|
|
14617
14617
|
const registeredLocalFontFaces = /* @__PURE__ */ new Set();
|
|
14618
|
+
let localFontFaceStyleEl = null;
|
|
14619
|
+
function ensureLocalFontFaceStyle() {
|
|
14620
|
+
if (typeof document === "undefined") return null;
|
|
14621
|
+
if (localFontFaceStyleEl && localFontFaceStyleEl.isConnected) return localFontFaceStyleEl;
|
|
14622
|
+
try {
|
|
14623
|
+
localFontFaceStyleEl = document.createElement("style");
|
|
14624
|
+
localFontFaceStyleEl.setAttribute("data-pixldocs-local-fontfaces", "1");
|
|
14625
|
+
document.head.appendChild(localFontFaceStyleEl);
|
|
14626
|
+
return localFontFaceStyleEl;
|
|
14627
|
+
} catch {
|
|
14628
|
+
return null;
|
|
14629
|
+
}
|
|
14630
|
+
}
|
|
14631
|
+
function appendLocalFontFaceRule(family, weight, style, file) {
|
|
14632
|
+
const styleEl = ensureLocalFontFaceStyle();
|
|
14633
|
+
if (!styleEl) return;
|
|
14634
|
+
const cssText = `@font-face{font-family:"${family}";src:url("/fonts/${file}");font-weight:${weight};font-style:${style};font-display:swap;}
|
|
14635
|
+
`;
|
|
14636
|
+
styleEl.appendChild(document.createTextNode(cssText));
|
|
14637
|
+
}
|
|
14618
14638
|
const LOCAL_FONT_FACE_VARIANTS = [
|
|
14619
14639
|
{ key: "regular", weight: 400, style: "normal" },
|
|
14620
14640
|
{ key: "bold", weight: 700, style: "normal" },
|
|
@@ -14644,6 +14664,7 @@ async function registerLocalFontFaces(fontFamily) {
|
|
|
14644
14664
|
style: variant.style
|
|
14645
14665
|
});
|
|
14646
14666
|
document.fonts.add(face);
|
|
14667
|
+
appendLocalFontFaceRule(fontFamily, variant.weight, variant.style, file);
|
|
14647
14668
|
loads.push(face.load().catch(() => void 0));
|
|
14648
14669
|
} catch {
|
|
14649
14670
|
}
|
|
@@ -15795,7 +15816,7 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
15795
15816
|
}
|
|
15796
15817
|
return svgString;
|
|
15797
15818
|
}
|
|
15798
|
-
const PACKAGE_VERSION = "0.5.
|
|
15819
|
+
const PACKAGE_VERSION = "0.5.135";
|
|
15799
15820
|
const roundParityValue = (value) => {
|
|
15800
15821
|
if (typeof value !== "number") return value;
|
|
15801
15822
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -16214,7 +16235,7 @@ class PixldocsRenderer {
|
|
|
16214
16235
|
await this.waitForCanvasScene(container, cloned, i);
|
|
16215
16236
|
}
|
|
16216
16237
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
16217
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
16238
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CyHRXea-.js");
|
|
16218
16239
|
const prepared = preparePagesForExport(
|
|
16219
16240
|
cloned.pages,
|
|
16220
16241
|
canvasWidth,
|
|
@@ -18117,7 +18138,6 @@ function rasterSvgToPngDataUrl(svgMarkup, pxW, pxH) {
|
|
|
18117
18138
|
const blob = new Blob([svgMarkup], { type: "image/svg+xml;charset=utf-8" });
|
|
18118
18139
|
const url = URL.createObjectURL(blob);
|
|
18119
18140
|
const img = new Image();
|
|
18120
|
-
img.crossOrigin = "anonymous";
|
|
18121
18141
|
const cleanup = () => {
|
|
18122
18142
|
try {
|
|
18123
18143
|
URL.revokeObjectURL(url);
|
|
@@ -18135,6 +18155,7 @@ function rasterSvgToPngDataUrl(svgMarkup, pxW, pxH) {
|
|
|
18135
18155
|
resolve(null);
|
|
18136
18156
|
return;
|
|
18137
18157
|
}
|
|
18158
|
+
ctx.clearRect(0, 0, pxW, pxH);
|
|
18138
18159
|
ctx.drawImage(img, 0, 0, pxW, pxH);
|
|
18139
18160
|
const dataUrl = canvas.toDataURL("image/png");
|
|
18140
18161
|
cleanup();
|
|
@@ -18306,7 +18327,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
18306
18327
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
18307
18328
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
18308
18329
|
try {
|
|
18309
|
-
const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-
|
|
18330
|
+
const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-CyHRXea-.js");
|
|
18310
18331
|
await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
|
|
18311
18332
|
} catch (e) {
|
|
18312
18333
|
console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
|
|
@@ -18651,4 +18672,4 @@ export {
|
|
|
18651
18672
|
collectFontDescriptorsFromConfig as y,
|
|
18652
18673
|
collectFontsFromConfig as z
|
|
18653
18674
|
};
|
|
18654
|
-
//# sourceMappingURL=index-
|
|
18675
|
+
//# sourceMappingURL=index-WM3oV4wa.js.map
|