@pixldocs/canvas-renderer 0.5.149 → 0.5.150

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-C6IaOn7u.cjs");
3
+ const index = require("./index-CczB1vpO.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, _ } from "./index-Bpxp8eDf.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, _ } from "./index-khnxviCH.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 { 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-Bpxp8eDf.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-khnxviCH.js";
5
5
  import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-b3_bv7F0.js";
6
6
  async function embedFontsForSvg(pdf, svgStr) {
7
7
  var _a;
@@ -1835,7 +1835,7 @@ async function collectInlinedFontFaceCss() {
1835
1835
  return cachedInlinedFontFaceCss;
1836
1836
  }
1837
1837
  async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, options) {
1838
- var _a;
1838
+ var _a, _b;
1839
1839
  try {
1840
1840
  const parser = new DOMParser();
1841
1841
  const processedSvg = inlineNestedSvgImageDataUris(rawSvg, parser);
@@ -1854,7 +1854,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
1854
1854
  normalizeSvgViewBoxOrigin(svg);
1855
1855
  disambiguateNestedSvgIds(svg);
1856
1856
  expandSvgUseElements(svg, pageKey);
1857
- const svgToDraw = normalizeSvgExplicitColors(svg);
1857
+ let svgToDraw = normalizeSvgExplicitColors(svg);
1858
1858
  inlineComputedStyles(svgToDraw);
1859
1859
  sanitizeSvgTreeForPdf(svgToDraw);
1860
1860
  normalizeSvgGradientStopOffsets(svgToDraw);
@@ -1873,10 +1873,27 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
1873
1873
  console.warn("[Vector PDF] anchor-bake pass failed (continuing):", e);
1874
1874
  }
1875
1875
  await rasterizeShadowMarkers(svgToDraw);
1876
+ try {
1877
+ if (svgToDraw.querySelector("g[data-pd-shadow-blur] text")) {
1878
+ const { convertAllTextToPath } = await import("./svgTextToPath-ws6Fh3rx.js");
1879
+ const outlined = await convertAllTextToPath(
1880
+ new XMLSerializer().serializeToString(svgToDraw),
1881
+ void 0,
1882
+ { mode: "shadow-bound" }
1883
+ );
1884
+ const outlinedDoc = parser.parseFromString(outlined, "image/svg+xml");
1885
+ if (!outlinedDoc.querySelector("parsererror") && ((_a = outlinedDoc.documentElement) == null ? void 0 : _a.tagName.toLowerCase()) === "svg") {
1886
+ svgToDraw = outlinedDoc.documentElement;
1887
+ console.log("[Vector PDF][parity] shadow-bound text outlined for headless alignment");
1888
+ }
1889
+ }
1890
+ } catch (outlineErr) {
1891
+ console.warn("[Vector PDF] shadow-bound text outline failed (continuing):", outlineErr);
1892
+ }
1876
1893
  await convertTextDecorationsToLines(svgToDraw);
1877
1894
  const rewritten = rewriteSvgFontsForJsPDFWithSourceMeta(new XMLSerializer().serializeToString(svgToDraw));
1878
1895
  const rewrittenDoc = parser.parseFromString(rewritten, "image/svg+xml");
1879
- if (!rewrittenDoc.querySelector("parsererror") && ((_a = rewrittenDoc.documentElement) == null ? void 0 : _a.tagName.toLowerCase()) === "svg") {
1896
+ if (!rewrittenDoc.querySelector("parsererror") && ((_b = rewrittenDoc.documentElement) == null ? void 0 : _b.tagName.toLowerCase()) === "svg") {
1880
1897
  return rewrittenDoc.documentElement;
1881
1898
  }
1882
1899
  return svgToDraw;
@@ -2458,7 +2475,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2458
2475
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2459
2476
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2460
2477
  try {
2461
- const { getNormalizedSvgUrl } = await import("./index-Bpxp8eDf.js").then((n) => n.$);
2478
+ const { getNormalizedSvgUrl } = await import("./index-khnxviCH.js").then((n) => n.$);
2462
2479
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2463
2480
  } catch {
2464
2481
  return null;
@@ -3239,7 +3256,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3239
3256
  }
3240
3257
  let fetchUrl = imageUrl;
3241
3258
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3242
- const { isPrivateUrl } = await import("./index-Bpxp8eDf.js").then((n) => n.$);
3259
+ const { isPrivateUrl } = await import("./index-khnxviCH.js").then((n) => n.$);
3243
3260
  if (isPrivateUrl(imageUrl)) return null;
3244
3261
  const proxyUrl = new URL(`${API_URL}/image-proxy`);
3245
3262
  proxyUrl.searchParams.set("url", imageUrl);
@@ -5223,4 +5240,4 @@ export {
5223
5240
  preparePagesForExport,
5224
5241
  rewriteSvgFontsForJsPDFWithSourceMeta
5225
5242
  };
5226
- //# sourceMappingURL=vectorPdfExport-DkZDHKeR.js.map
5243
+ //# sourceMappingURL=vectorPdfExport-CDnEStQk.js.map