@pixldocs/canvas-renderer 0.5.149 → 0.5.151
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-C6IaOn7u.cjs → index-Clvky1Ne.cjs} +62 -9
- package/dist/index-Clvky1Ne.cjs.map +1 -0
- package/dist/{index-Bpxp8eDf.js → index-Dp8yJxTW.js} +62 -9
- package/dist/index-Dp8yJxTW.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{svgTextToPath-ws6Fh3rx.js → svgTextToPath-BE8TxgiO.js} +2 -2
- package/dist/svgTextToPath-BE8TxgiO.js.map +1 -0
- package/dist/{svgTextToPath-DolCNU9g.cjs → svgTextToPath-qhinMiiS.cjs} +2 -2
- package/dist/svgTextToPath-qhinMiiS.cjs.map +1 -0
- package/dist/{vectorPdfExport-FwEcQIPB.cjs → vectorPdfExport-BEohav7Y.cjs} +24 -7
- package/dist/vectorPdfExport-BEohav7Y.cjs.map +1 -0
- package/dist/{vectorPdfExport-DkZDHKeR.js → vectorPdfExport-TF3IGImZ.js} +24 -7
- package/dist/vectorPdfExport-TF3IGImZ.js.map +1 -0
- package/package.json +1 -1
- package/dist/index-Bpxp8eDf.js.map +0 -1
- package/dist/index-C6IaOn7u.cjs.map +0 -1
- package/dist/svgTextToPath-DolCNU9g.cjs.map +0 -1
- package/dist/svgTextToPath-ws6Fh3rx.js.map +0 -1
- package/dist/vectorPdfExport-DkZDHKeR.js.map +0 -1
- package/dist/vectorPdfExport-FwEcQIPB.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-Dp8yJxTW.js";
|
|
5
5
|
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-b3_bv7F0.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
@@ -1835,7 +1835,7 @@ async function collectInlinedFontFaceCss() {
|
|
|
1835
1835
|
return cachedInlinedFontFaceCss;
|
|
1836
1836
|
}
|
|
1837
1837
|
async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, options) {
|
|
1838
|
-
var _a;
|
|
1838
|
+
var _a, _b;
|
|
1839
1839
|
try {
|
|
1840
1840
|
const parser = new DOMParser();
|
|
1841
1841
|
const processedSvg = inlineNestedSvgImageDataUris(rawSvg, parser);
|
|
@@ -1854,7 +1854,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
1854
1854
|
normalizeSvgViewBoxOrigin(svg);
|
|
1855
1855
|
disambiguateNestedSvgIds(svg);
|
|
1856
1856
|
expandSvgUseElements(svg, pageKey);
|
|
1857
|
-
|
|
1857
|
+
let svgToDraw = normalizeSvgExplicitColors(svg);
|
|
1858
1858
|
inlineComputedStyles(svgToDraw);
|
|
1859
1859
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
1860
1860
|
normalizeSvgGradientStopOffsets(svgToDraw);
|
|
@@ -1873,10 +1873,27 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
1873
1873
|
console.warn("[Vector PDF] anchor-bake pass failed (continuing):", e);
|
|
1874
1874
|
}
|
|
1875
1875
|
await rasterizeShadowMarkers(svgToDraw);
|
|
1876
|
+
try {
|
|
1877
|
+
if (svgToDraw.querySelector("g[data-pd-shadow-blur] text, g[data-pd-text-bg] text")) {
|
|
1878
|
+
const { convertAllTextToPath } = await import("./svgTextToPath-BE8TxgiO.js");
|
|
1879
|
+
const outlined = await convertAllTextToPath(
|
|
1880
|
+
new XMLSerializer().serializeToString(svgToDraw),
|
|
1881
|
+
void 0,
|
|
1882
|
+
{ mode: "shadow-bound" }
|
|
1883
|
+
);
|
|
1884
|
+
const outlinedDoc = parser.parseFromString(outlined, "image/svg+xml");
|
|
1885
|
+
if (!outlinedDoc.querySelector("parsererror") && ((_a = outlinedDoc.documentElement) == null ? void 0 : _a.tagName.toLowerCase()) === "svg") {
|
|
1886
|
+
svgToDraw = outlinedDoc.documentElement;
|
|
1887
|
+
console.log("[Vector PDF][parity] decorated text outlined for headless alignment");
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
} catch (outlineErr) {
|
|
1891
|
+
console.warn("[Vector PDF] shadow-bound text outline failed (continuing):", outlineErr);
|
|
1892
|
+
}
|
|
1876
1893
|
await convertTextDecorationsToLines(svgToDraw);
|
|
1877
1894
|
const rewritten = rewriteSvgFontsForJsPDFWithSourceMeta(new XMLSerializer().serializeToString(svgToDraw));
|
|
1878
1895
|
const rewrittenDoc = parser.parseFromString(rewritten, "image/svg+xml");
|
|
1879
|
-
if (!rewrittenDoc.querySelector("parsererror") && ((
|
|
1896
|
+
if (!rewrittenDoc.querySelector("parsererror") && ((_b = rewrittenDoc.documentElement) == null ? void 0 : _b.tagName.toLowerCase()) === "svg") {
|
|
1880
1897
|
return rewrittenDoc.documentElement;
|
|
1881
1898
|
}
|
|
1882
1899
|
return svgToDraw;
|
|
@@ -2458,7 +2475,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2458
2475
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2459
2476
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2460
2477
|
try {
|
|
2461
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2478
|
+
const { getNormalizedSvgUrl } = await import("./index-Dp8yJxTW.js").then((n) => n.$);
|
|
2462
2479
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2463
2480
|
} catch {
|
|
2464
2481
|
return null;
|
|
@@ -3239,7 +3256,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3239
3256
|
}
|
|
3240
3257
|
let fetchUrl = imageUrl;
|
|
3241
3258
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3242
|
-
const { isPrivateUrl } = await import("./index-
|
|
3259
|
+
const { isPrivateUrl } = await import("./index-Dp8yJxTW.js").then((n) => n.$);
|
|
3243
3260
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3244
3261
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3245
3262
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5223,4 +5240,4 @@ export {
|
|
|
5223
5240
|
preparePagesForExport,
|
|
5224
5241
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5225
5242
|
};
|
|
5226
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5243
|
+
//# sourceMappingURL=vectorPdfExport-TF3IGImZ.js.map
|