@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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-DTcFAvP2.cjs");
3
+ const index = require("./index-BBOaToIA.cjs");
4
4
  exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
5
5
  exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
6
6
  exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, b, M, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1 } from "./index-Dj7Bs3EZ.js";
1
+ import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, b, M, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1 } from "./index-C3W71an-.js";
2
2
  export {
3
3
  D as DEPLOYMENT_VERSION_MARKER,
4
4
  F as FONT_FALLBACK_DEVANAGARI,
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jspdf = require("jspdf");
4
4
  const svg2pdf_js = require("svg2pdf.js");
5
5
  const fabric = require("fabric");
6
- const index = require("./index-DTcFAvP2.cjs");
6
+ const index = require("./index-BBOaToIA.cjs");
7
7
  const pdfFonts = require("./pdfFonts-BTj2f465.cjs");
8
8
  function _interopNamespaceDefault(e) {
9
9
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -841,7 +841,7 @@ function injectOpacityIntoSvg(svg, opacity) {
841
841
  function bakeGroupOpacityIntoChildren(svg) {
842
842
  const DRAWABLE_TAGS = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
843
843
  function walkAndBake(el, inheritedOpacity) {
844
- var _a, _b, _c;
844
+ var _a, _b, _c, _d;
845
845
  if (isInSvgDefinitionSubtree(el)) {
846
846
  for (let i = 0; i < el.children.length; i++) {
847
847
  walkAndBake(el.children[i], 1);
@@ -853,7 +853,7 @@ function bakeGroupOpacityIntoChildren(svg) {
853
853
  const styleOpacity = parseSvgOpacity(((_b = el.style) == null ? void 0 : _b.getPropertyValue("opacity")) || null);
854
854
  const ownOpacity = opacityAttr ?? styleOpacity ?? 1;
855
855
  const combinedOpacity = inheritedOpacity * ownOpacity;
856
- if (ownOpacity < 0.999) {
856
+ if (ownOpacity < 0.999 && tag !== "image") {
857
857
  el.removeAttribute("opacity");
858
858
  if ((_c = el.style) == null ? void 0 : _c.opacity) {
859
859
  el.style.removeProperty("opacity");
@@ -863,6 +863,12 @@ function bakeGroupOpacityIntoChildren(svg) {
863
863
  multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
864
864
  multiplySvgOpacityAttr(el, "stroke-opacity", combinedOpacity);
865
865
  }
866
+ if (tag === "image" && combinedOpacity < 0.999) {
867
+ el.setAttribute("opacity", String(Number(combinedOpacity.toFixed(4))));
868
+ if ((_d = el.style) == null ? void 0 : _d.opacity) {
869
+ el.style.removeProperty("opacity");
870
+ }
871
+ }
866
872
  if (tag === "stop" && ownOpacity < 0.999) {
867
873
  multiplySvgOpacityAttr(el, "stop-opacity", ownOpacity);
868
874
  }
@@ -2519,7 +2525,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2519
2525
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2520
2526
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2521
2527
  try {
2522
- const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-DTcFAvP2.cjs")).then((n) => n.canvasImageLoader);
2528
+ const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-BBOaToIA.cjs")).then((n) => n.canvasImageLoader);
2523
2529
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2524
2530
  } catch {
2525
2531
  return null;
@@ -3310,7 +3316,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3310
3316
  }
3311
3317
  let fetchUrl = imageUrl;
3312
3318
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3313
- const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-DTcFAvP2.cjs")).then((n) => n.canvasImageLoader);
3319
+ const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-BBOaToIA.cjs")).then((n) => n.canvasImageLoader);
3314
3320
  if (isPrivateUrl(imageUrl)) return null;
3315
3321
  const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
3316
3322
  proxyUrl.searchParams.set("url", imageUrl);
@@ -5304,4 +5310,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
5304
5310
  exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
5305
5311
  exports.preparePagesForExport = preparePagesForExport;
5306
5312
  exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
5307
- //# sourceMappingURL=vectorPdfExport-Qffqnh7w.cjs.map
5313
+ //# sourceMappingURL=vectorPdfExport-Be8MJ_2c.cjs.map