@pixldocs/canvas-renderer 0.5.213 → 0.5.215

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-zkVpb-YL.cjs");
3
+ const index = require("./index-CzwZcfGF.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, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5 } from "./index-XZf4TDQ-.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, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5 } from "./index-BV_MP9XQ.js";
2
2
  export {
3
3
  D as DEPLOYMENT_VERSION_MARKER,
4
4
  F as FONT_FALLBACK_DEVANAGARI,
@@ -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 { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-XZf4TDQ-.js";
4
+ import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-BV_MP9XQ.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;
@@ -150,7 +150,7 @@ async function ensureImageDecoded(img) {
150
150
  } catch {
151
151
  }
152
152
  }
153
- const SHADOW_RASTER_ALPHA_COMPENSATION = 0.84;
153
+ const SHADOW_RASTER_ALPHA_COMPENSATION = 1;
154
154
  function collectFontSpecsFromShadowMarkup(markup) {
155
155
  const specs = /* @__PURE__ */ new Set();
156
156
  const re = /<(?:text|tspan)\b[^>]*>/gi;
@@ -2060,7 +2060,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
2060
2060
  }
2061
2061
  }
2062
2062
  async function rasterizeShadowMarkers(svg) {
2063
- var _a, _b, _c, _d, _e, _f, _g;
2063
+ var _a, _b, _c, _d, _e, _f;
2064
2064
  if (typeof window === "undefined" || typeof document === "undefined") return;
2065
2065
  const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
2066
2066
  if (markers.length === 0) return;
@@ -2115,29 +2115,15 @@ async function rasterizeShadowMarkers(svg) {
2115
2115
  img.setAttribute("y", String(by));
2116
2116
  img.setAttribute("width", String(bw));
2117
2117
  img.setAttribute("height", String(bh));
2118
- img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
2119
2118
  img.setAttribute("preserveAspectRatio", "none");
2120
2119
  img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
2121
2120
  img.setAttribute("href", dataUrl);
2122
- const passes = Math.max(1, Math.min(8, parseInt(marker.getAttribute("data-passes") || "1", 10) || 1));
2123
- const lastAlphaRaw = parseFloat(marker.getAttribute("data-last-alpha") || "1");
2124
- const lastAlpha = Number.isFinite(lastAlphaRaw) ? Math.max(0, Math.min(1, lastAlphaRaw)) : 1;
2125
- const baseOpacity = Number(img.getAttribute("opacity") || "1") || 1;
2121
+ img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
2126
2122
  (_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
2127
- for (let i = 1; i < passes; i++) {
2128
- const extra = img.cloneNode(true);
2129
- if (i === passes - 1 && lastAlpha < 1) {
2130
- extra.setAttribute("opacity", String(baseOpacity * lastAlpha));
2131
- }
2132
- (_f = img.parentNode) == null ? void 0 : _f.insertBefore(extra, img.nextSibling);
2133
- }
2134
- if (passes === 1 && lastAlpha < 1) {
2135
- img.setAttribute("opacity", String(baseOpacity * lastAlpha));
2136
- }
2137
2123
  } catch (error) {
2138
2124
  console.warn("[Vector PDF] text shadow rasterization failed for one marker:", error);
2139
2125
  try {
2140
- (_g = marker.parentNode) == null ? void 0 : _g.removeChild(marker);
2126
+ (_f = marker.parentNode) == null ? void 0 : _f.removeChild(marker);
2141
2127
  } catch {
2142
2128
  }
2143
2129
  }
@@ -2965,7 +2951,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2965
2951
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2966
2952
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2967
2953
  try {
2968
- const { getNormalizedSvgUrl } = await import("./index-XZf4TDQ-.js").then((n) => n.a6);
2954
+ const { getNormalizedSvgUrl } = await import("./index-BV_MP9XQ.js").then((n) => n.a6);
2969
2955
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2970
2956
  } catch {
2971
2957
  return null;
@@ -3774,7 +3760,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3774
3760
  }
3775
3761
  let fetchUrl = imageUrl;
3776
3762
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3777
- const { isPrivateUrl } = await import("./index-XZf4TDQ-.js").then((n) => n.a6);
3763
+ const { isPrivateUrl } = await import("./index-BV_MP9XQ.js").then((n) => n.a6);
3778
3764
  if (isPrivateUrl(imageUrl)) return null;
3779
3765
  const proxyUrl = new URL(`${API_URL}/image-proxy`);
3780
3766
  proxyUrl.searchParams.set("url", imageUrl);
@@ -5875,4 +5861,4 @@ export {
5875
5861
  preparePagesForExport,
5876
5862
  rewriteSvgFontsForJsPDFWithSourceMeta
5877
5863
  };
5878
- //# sourceMappingURL=vectorPdfExport-ox1nl4G9.js.map
5864
+ //# sourceMappingURL=vectorPdfExport-CN1fcrfR.js.map