@pixldocs/canvas-renderer 0.5.215 → 0.5.217

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-CzwZcfGF.cjs");
3
+ const index = require("./index-CDrMSTDa.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-BV_MP9XQ.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-Ci5YA_Ps.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-CzwZcfGF.cjs");
6
+ const index = require("./index-CDrMSTDa.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" } });
@@ -2099,6 +2099,9 @@ async function rasterizeShadowMarkers(svg) {
2099
2099
  const by = parseFloat(marker.getAttribute("data-by") || "0");
2100
2100
  const bw = parseFloat(marker.getAttribute("data-bw") || "0");
2101
2101
  const bh = parseFloat(marker.getAttribute("data-bh") || "0");
2102
+ const spread = parseFloat(marker.getAttribute("data-spread") || "0");
2103
+ const alphaRaw = parseFloat(marker.getAttribute("data-alpha") || "1");
2104
+ const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
2102
2105
  if (!Number.isFinite(bw) || !Number.isFinite(bh) || bw <= 0 || bh <= 0) {
2103
2106
  (_b = marker.parentNode) == null ? void 0 : _b.removeChild(marker);
2104
2107
  continue;
@@ -2122,7 +2125,8 @@ async function rasterizeShadowMarkers(svg) {
2122
2125
  const pxH = Math.min(4096, Math.max(8, Math.ceil(bh * scale)));
2123
2126
  const stdDev = Math.max(0, blur / 2);
2124
2127
  const filterId = `pdShadowBlur_${Math.random().toString(36).slice(2, 9)}`;
2125
- const styleBlock = fontFaceCss ? `<style>${fontFaceCss}</style>` : "";
2128
+ const spreadCss = spread > 0 ? `text,tspan,path{paint-order:stroke fill;stroke:currentColor;stroke-width:${spread.toFixed(3)}px;stroke-linejoin:round;stroke-linecap:round;}` : "";
2129
+ const styleBlock = fontFaceCss || spreadCss ? `<style>${fontFaceCss}${spreadCss}</style>` : "";
2126
2130
  const miniSvg = `<svg xmlns="${SVG_NS}" xmlns:xlink="${XLINK_NS}" width="${pxW}" height="${pxH}" viewBox="${bx} ${by} ${bw} ${bh}">${styleBlock}<defs><filter id="${filterId}" filterUnits="userSpaceOnUse" x="${bx}" y="${by}" width="${bw}" height="${bh}" color-interpolation-filters="sRGB"><feOffset dx="${ox}" dy="${oy}" result="offsetShadow" /><feGaussianBlur in="offsetShadow" stdDeviation="${stdDev}" /></filter></defs><g filter="url(#${filterId})">${innerXml}</g></svg>`;
2127
2131
  const dataUrl = await rasterSvgToPngDataUrl(miniSvg, pxW, pxH);
2128
2132
  if (!dataUrl) {
@@ -2137,7 +2141,7 @@ async function rasterizeShadowMarkers(svg) {
2137
2141
  img.setAttribute("preserveAspectRatio", "none");
2138
2142
  img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
2139
2143
  img.setAttribute("href", dataUrl);
2140
- img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
2144
+ img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION * shadowAlpha));
2141
2145
  (_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
2142
2146
  } catch (error) {
2143
2147
  console.warn("[Vector PDF] text shadow rasterization failed for one marker:", error);
@@ -2970,7 +2974,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2970
2974
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2971
2975
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2972
2976
  try {
2973
- const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-CzwZcfGF.cjs")).then((n) => n.canvasImageLoader);
2977
+ const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-CDrMSTDa.cjs")).then((n) => n.canvasImageLoader);
2974
2978
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2975
2979
  } catch {
2976
2980
  return null;
@@ -3779,7 +3783,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3779
3783
  }
3780
3784
  let fetchUrl = imageUrl;
3781
3785
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3782
- const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-CzwZcfGF.cjs")).then((n) => n.canvasImageLoader);
3786
+ const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-CDrMSTDa.cjs")).then((n) => n.canvasImageLoader);
3783
3787
  if (isPrivateUrl(imageUrl)) return null;
3784
3788
  const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
3785
3789
  proxyUrl.searchParams.set("url", imageUrl);
@@ -5878,4 +5882,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
5878
5882
  exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
5879
5883
  exports.preparePagesForExport = preparePagesForExport;
5880
5884
  exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
5881
- //# sourceMappingURL=vectorPdfExport-DUohXw5V.cjs.map
5885
+ //# sourceMappingURL=vectorPdfExport-B8uqWQoW.cjs.map