@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.
@@ -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-Dj7Bs3EZ.js";
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-Dj7Bs3EZ.js").then((n) => n.a2);
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-Dj7Bs3EZ.js").then((n) => n.a2);
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-3KWX0dvS.js.map
5296
+ //# sourceMappingURL=vectorPdfExport-FmQQMHmX.js.map