@pixldocs/canvas-renderer 0.5.131 → 0.5.133
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-Cc5u_TJx.cjs → index-D5rY5lp8.cjs} +43 -14
- package/dist/index-D5rY5lp8.cjs.map +1 -0
- package/dist/{index-ft7TuZPu.js → index-DMkFzgNL.js} +43 -14
- package/dist/index-DMkFzgNL.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{pdfFonts-Cr8l-y3z.cjs → pdfFonts-BU2Lqz_O.cjs} +36 -11
- package/dist/{pdfFonts-Cr8l-y3z.cjs.map → pdfFonts-BU2Lqz_O.cjs.map} +1 -1
- package/dist/{pdfFonts-Y49FLHuG.js → pdfFonts-BVHbPFEz.js} +36 -11
- package/dist/{pdfFonts-Y49FLHuG.js.map → pdfFonts-BVHbPFEz.js.map} +1 -1
- package/dist/{svgTextToPath-DMx9Buca.js → svgTextToPath-DG7rcbDE.js} +67 -5
- package/dist/svgTextToPath-DG7rcbDE.js.map +1 -0
- package/dist/{svgTextToPath-DcI_oipn.cjs → svgTextToPath-GeR0CexD.cjs} +67 -5
- package/dist/svgTextToPath-GeR0CexD.cjs.map +1 -0
- package/dist/{vectorPdfExport-C96oIwLP.js → vectorPdfExport-BQO8W14A.js} +8 -31
- package/dist/vectorPdfExport-BQO8W14A.js.map +1 -0
- package/dist/{vectorPdfExport-CA5X2N63.cjs → vectorPdfExport-DCNpWd6K.cjs} +8 -31
- package/dist/vectorPdfExport-DCNpWd6K.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-Cc5u_TJx.cjs.map +0 -1
- package/dist/index-ft7TuZPu.js.map +0 -1
- package/dist/svgTextToPath-DMx9Buca.js.map +0 -1
- package/dist/svgTextToPath-DcI_oipn.cjs.map +0 -1
- package/dist/vectorPdfExport-C96oIwLP.js.map +0 -1
- package/dist/vectorPdfExport-CA5X2N63.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsPDF, ShadingPattern } from "jspdf";
|
|
2
2
|
import { svg2pdf } from "svg2pdf.js";
|
|
3
3
|
import * as fabric from "fabric";
|
|
4
|
-
import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, d as bakeEdgeFade, i as isElement, e as isGroup, j as buildRoundedTrianglePath, A as API_URL, k as getImageProxyFetchOptions, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-
|
|
5
|
-
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-
|
|
4
|
+
import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, d as bakeEdgeFade, i as isElement, e as isGroup, j as buildRoundedTrianglePath, A as API_URL, k as getImageProxyFetchOptions, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-DMkFzgNL.js";
|
|
5
|
+
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-BVHbPFEz.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
8
8
|
const {
|
|
@@ -12,7 +12,7 @@ async function embedFontsForSvg(pdf, svgStr) {
|
|
|
12
12
|
FONT_FALLBACK_SYMBOLS: FONT_FALLBACK_SYMBOLS2,
|
|
13
13
|
FONT_FALLBACK_DEVANAGARI: FONT_FALLBACK_DEVANAGARI2,
|
|
14
14
|
FONT_FALLBACK_MATH: FONT_FALLBACK_MATH2
|
|
15
|
-
} = await import("./pdfFonts-
|
|
15
|
+
} = await import("./pdfFonts-BVHbPFEz.js");
|
|
16
16
|
const parser = new DOMParser();
|
|
17
17
|
const doc = parser.parseFromString(svgStr, "image/svg+xml");
|
|
18
18
|
const textEls = Array.from(doc.querySelectorAll("text, tspan, textPath"));
|
|
@@ -1601,7 +1601,7 @@ async function collectInlinedFontFaceCss() {
|
|
|
1601
1601
|
return cachedInlinedFontFaceCss;
|
|
1602
1602
|
}
|
|
1603
1603
|
async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, options) {
|
|
1604
|
-
var _a
|
|
1604
|
+
var _a;
|
|
1605
1605
|
try {
|
|
1606
1606
|
const parser = new DOMParser();
|
|
1607
1607
|
const processedSvg = inlineNestedSvgImageDataUris(rawSvg, parser);
|
|
@@ -1637,34 +1637,11 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
1637
1637
|
} catch (e) {
|
|
1638
1638
|
console.warn("[Vector PDF] anchor-bake pass failed (continuing):", e);
|
|
1639
1639
|
}
|
|
1640
|
-
try {
|
|
1641
|
-
const hasShadowText = !!svgToDraw.querySelector("[data-pd-shadow-blur]") || !!svgToDraw.querySelector("g.__pdShadowRaster text");
|
|
1642
|
-
if (hasShadowText) {
|
|
1643
|
-
const { convertAllTextToPath } = await import("./svgTextToPath-DMx9Buca.js");
|
|
1644
|
-
const serialized = new XMLSerializer().serializeToString(svgToDraw);
|
|
1645
|
-
const outlined = await convertAllTextToPath(serialized, void 0, { mode: "shadow-bound" });
|
|
1646
|
-
const reparsed = parser.parseFromString(outlined, "image/svg+xml");
|
|
1647
|
-
if (!reparsed.querySelector("parsererror") && ((_a = reparsed.documentElement) == null ? void 0 : _a.tagName.toLowerCase()) === "svg") {
|
|
1648
|
-
while (svgToDraw.firstChild) svgToDraw.removeChild(svgToDraw.firstChild);
|
|
1649
|
-
for (const child of Array.from(reparsed.documentElement.childNodes)) {
|
|
1650
|
-
svgToDraw.appendChild(svgToDraw.ownerDocument.importNode(child, true));
|
|
1651
|
-
}
|
|
1652
|
-
for (const attr of Array.from(reparsed.documentElement.attributes)) {
|
|
1653
|
-
try {
|
|
1654
|
-
svgToDraw.setAttribute(attr.name, attr.value);
|
|
1655
|
-
} catch {
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
} catch (e) {
|
|
1661
|
-
console.warn("[Vector PDF] shadow-bound text outlining failed (continuing without parity outlining):", e);
|
|
1662
|
-
}
|
|
1663
1640
|
await rasterizeShadowMarkers(svgToDraw);
|
|
1664
1641
|
await convertTextDecorationsToLines(svgToDraw);
|
|
1665
1642
|
const rewritten = rewriteSvgFontsForJsPDFWithSourceMeta(new XMLSerializer().serializeToString(svgToDraw));
|
|
1666
1643
|
const rewrittenDoc = parser.parseFromString(rewritten, "image/svg+xml");
|
|
1667
|
-
if (!rewrittenDoc.querySelector("parsererror") && ((
|
|
1644
|
+
if (!rewrittenDoc.querySelector("parsererror") && ((_a = rewrittenDoc.documentElement) == null ? void 0 : _a.tagName.toLowerCase()) === "svg") {
|
|
1668
1645
|
return rewrittenDoc.documentElement;
|
|
1669
1646
|
}
|
|
1670
1647
|
return svgToDraw;
|
|
@@ -2246,7 +2223,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2246
2223
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2247
2224
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2248
2225
|
try {
|
|
2249
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2226
|
+
const { getNormalizedSvgUrl } = await import("./index-DMkFzgNL.js").then((n) => n._);
|
|
2250
2227
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2251
2228
|
} catch {
|
|
2252
2229
|
return null;
|
|
@@ -3027,7 +3004,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3027
3004
|
}
|
|
3028
3005
|
let fetchUrl = imageUrl;
|
|
3029
3006
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3030
|
-
const { isPrivateUrl } = await import("./index-
|
|
3007
|
+
const { isPrivateUrl } = await import("./index-DMkFzgNL.js").then((n) => n._);
|
|
3031
3008
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3032
3009
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3033
3010
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5010,4 +4987,4 @@ export {
|
|
|
5010
4987
|
preparePagesForExport,
|
|
5011
4988
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5012
4989
|
};
|
|
5013
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
4990
|
+
//# sourceMappingURL=vectorPdfExport-BQO8W14A.js.map
|