@pixldocs/canvas-renderer 0.5.178 → 0.5.179
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-DTcFAvP2.cjs → index-BBOaToIA.cjs} +11 -7
- package/dist/{index-DTcFAvP2.cjs.map → index-BBOaToIA.cjs.map} +1 -1
- package/dist/{index-Dj7Bs3EZ.js → index-C3W71an-.js} +11 -7
- package/dist/{index-Dj7Bs3EZ.js.map → index-C3W71an-.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-Qffqnh7w.cjs → vectorPdfExport-Be8MJ_2c.cjs} +12 -6
- package/dist/vectorPdfExport-Be8MJ_2c.cjs.map +1 -0
- package/dist/{vectorPdfExport-3KWX0dvS.js → vectorPdfExport-FmQQMHmX.js} +12 -6
- package/dist/vectorPdfExport-FmQQMHmX.js.map +1 -0
- package/package.json +1 -1
- package/dist/vectorPdfExport-3KWX0dvS.js.map +0 -1
- package/dist/vectorPdfExport-Qffqnh7w.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-C3W71an-.js";
|
|
5
5
|
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-DhEaMTZl.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
@@ -822,7 +822,7 @@ function injectOpacityIntoSvg(svg, opacity) {
|
|
|
822
822
|
function bakeGroupOpacityIntoChildren(svg) {
|
|
823
823
|
const DRAWABLE_TAGS = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
|
|
824
824
|
function walkAndBake(el, inheritedOpacity) {
|
|
825
|
-
var _a, _b, _c;
|
|
825
|
+
var _a, _b, _c, _d;
|
|
826
826
|
if (isInSvgDefinitionSubtree(el)) {
|
|
827
827
|
for (let i = 0; i < el.children.length; i++) {
|
|
828
828
|
walkAndBake(el.children[i], 1);
|
|
@@ -834,7 +834,7 @@ function bakeGroupOpacityIntoChildren(svg) {
|
|
|
834
834
|
const styleOpacity = parseSvgOpacity(((_b = el.style) == null ? void 0 : _b.getPropertyValue("opacity")) || null);
|
|
835
835
|
const ownOpacity = opacityAttr ?? styleOpacity ?? 1;
|
|
836
836
|
const combinedOpacity = inheritedOpacity * ownOpacity;
|
|
837
|
-
if (ownOpacity < 0.999) {
|
|
837
|
+
if (ownOpacity < 0.999 && tag !== "image") {
|
|
838
838
|
el.removeAttribute("opacity");
|
|
839
839
|
if ((_c = el.style) == null ? void 0 : _c.opacity) {
|
|
840
840
|
el.style.removeProperty("opacity");
|
|
@@ -844,6 +844,12 @@ function bakeGroupOpacityIntoChildren(svg) {
|
|
|
844
844
|
multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
|
|
845
845
|
multiplySvgOpacityAttr(el, "stroke-opacity", combinedOpacity);
|
|
846
846
|
}
|
|
847
|
+
if (tag === "image" && combinedOpacity < 0.999) {
|
|
848
|
+
el.setAttribute("opacity", String(Number(combinedOpacity.toFixed(4))));
|
|
849
|
+
if ((_d = el.style) == null ? void 0 : _d.opacity) {
|
|
850
|
+
el.style.removeProperty("opacity");
|
|
851
|
+
}
|
|
852
|
+
}
|
|
847
853
|
if (tag === "stop" && ownOpacity < 0.999) {
|
|
848
854
|
multiplySvgOpacityAttr(el, "stop-opacity", ownOpacity);
|
|
849
855
|
}
|
|
@@ -2500,7 +2506,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2500
2506
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2501
2507
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2502
2508
|
try {
|
|
2503
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2509
|
+
const { getNormalizedSvgUrl } = await import("./index-C3W71an-.js").then((n) => n.a2);
|
|
2504
2510
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2505
2511
|
} catch {
|
|
2506
2512
|
return null;
|
|
@@ -3291,7 +3297,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3291
3297
|
}
|
|
3292
3298
|
let fetchUrl = imageUrl;
|
|
3293
3299
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3294
|
-
const { isPrivateUrl } = await import("./index-
|
|
3300
|
+
const { isPrivateUrl } = await import("./index-C3W71an-.js").then((n) => n.a2);
|
|
3295
3301
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3296
3302
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3297
3303
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5287,4 +5293,4 @@ export {
|
|
|
5287
5293
|
preparePagesForExport,
|
|
5288
5294
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5289
5295
|
};
|
|
5290
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5296
|
+
//# sourceMappingURL=vectorPdfExport-FmQQMHmX.js.map
|