@pixldocs/canvas-renderer 0.5.152 → 0.5.154

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-DjobDQ7X.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-CoH2Xntr.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;
@@ -1247,6 +1247,7 @@ async function bakeTextAnchorPositionsFromLiveSvg(svg) {
1247
1247
  return NaN;
1248
1248
  };
1249
1249
  const bakeNode = (srcNode, liveNode, anchorOverride, refXOverride) => {
1250
+ if (srcNode.getAttribute("data-pd-line-anchor") === "1") return;
1250
1251
  const anchor = (anchorOverride || _resolveAnchor(srcNode)).trim().toLowerCase();
1251
1252
  if (anchor !== "middle" && anchor !== "end") return;
1252
1253
  try {
@@ -1835,7 +1836,7 @@ async function collectInlinedFontFaceCss() {
1835
1836
  return cachedInlinedFontFaceCss;
1836
1837
  }
1837
1838
  async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, options) {
1838
- var _a, _b;
1839
+ var _a;
1839
1840
  try {
1840
1841
  const parser = new DOMParser();
1841
1842
  const processedSvg = inlineNestedSvgImageDataUris(rawSvg, parser);
@@ -1873,27 +1874,10 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
1873
1874
  console.warn("[Vector PDF] anchor-bake pass failed (continuing):", e);
1874
1875
  }
1875
1876
  await rasterizeShadowMarkers(svgToDraw);
1876
- try {
1877
- if (svgToDraw.querySelector("g[data-pd-shadow-blur] text, g[data-pd-text-bg] text")) {
1878
- const { convertAllTextToPath } = await import("./svgTextToPath-BE8TxgiO.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] decorated text outlined for headless alignment");
1888
- }
1889
- }
1890
- } catch (outlineErr) {
1891
- console.warn("[Vector PDF] shadow-bound text outline failed (continuing):", outlineErr);
1892
- }
1893
1877
  await convertTextDecorationsToLines(svgToDraw);
1894
1878
  const rewritten = rewriteSvgFontsForJsPDFWithSourceMeta(new XMLSerializer().serializeToString(svgToDraw));
1895
1879
  const rewrittenDoc = parser.parseFromString(rewritten, "image/svg+xml");
1896
- if (!rewrittenDoc.querySelector("parsererror") && ((_b = rewrittenDoc.documentElement) == null ? void 0 : _b.tagName.toLowerCase()) === "svg") {
1880
+ if (!rewrittenDoc.querySelector("parsererror") && ((_a = rewrittenDoc.documentElement) == null ? void 0 : _a.tagName.toLowerCase()) === "svg") {
1897
1881
  return rewrittenDoc.documentElement;
1898
1882
  }
1899
1883
  return svgToDraw;
@@ -2475,7 +2459,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2475
2459
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2476
2460
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2477
2461
  try {
2478
- const { getNormalizedSvgUrl } = await import("./index-DjobDQ7X.js").then((n) => n.$);
2462
+ const { getNormalizedSvgUrl } = await import("./index-CoH2Xntr.js").then((n) => n.$);
2479
2463
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2480
2464
  } catch {
2481
2465
  return null;
@@ -3256,7 +3240,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3256
3240
  }
3257
3241
  let fetchUrl = imageUrl;
3258
3242
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3259
- const { isPrivateUrl } = await import("./index-DjobDQ7X.js").then((n) => n.$);
3243
+ const { isPrivateUrl } = await import("./index-CoH2Xntr.js").then((n) => n.$);
3260
3244
  if (isPrivateUrl(imageUrl)) return null;
3261
3245
  const proxyUrl = new URL(`${API_URL}/image-proxy`);
3262
3246
  proxyUrl.searchParams.set("url", imageUrl);
@@ -5240,4 +5224,4 @@ export {
5240
5224
  preparePagesForExport,
5241
5225
  rewriteSvgFontsForJsPDFWithSourceMeta
5242
5226
  };
5243
- //# sourceMappingURL=vectorPdfExport-RiNowoiG.js.map
5227
+ //# sourceMappingURL=vectorPdfExport-Db9b2C3K.js.map