@pixldocs/canvas-renderer 0.5.125 → 0.5.126

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, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, c as bakeEdgeFade, i as isElement, d as isGroup, e as buildRoundedTrianglePath, A as API_URL, j as getImageProxyFetchOptions, k as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, l as getTrianglePoints } from "./index-D7cGwzxX.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-D-lngEWM.js";
5
5
  import { r as resetPdfFontRegistry, F as FONT_FALLBACK_SYMBOLS, a as FONT_FALLBACK_MATH, b as FONT_FALLBACK_DEVANAGARI, e as embedFontWithGoogleFallback, g as getEmbeddedVariantsList, i as isFontAvailable, c as isFamilyEmbedded, d as resolveBestRegisteredVariant, f as getEmbeddedJsPDFFontName, h as resolveFontWeight, j as doesVariantSupportChar } from "./pdfFonts-CZpNVjX9.js";
6
6
  async function bakeEdgeFadeIntoDataUrl(dataUrl, element) {
7
7
  const fade = element;
@@ -2022,7 +2022,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2022
2022
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2023
2023
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2024
2024
  try {
2025
- const { getNormalizedSvgUrl } = await import("./index-D7cGwzxX.js").then((n) => n.Z);
2025
+ const { getNormalizedSvgUrl } = await import("./index-D-lngEWM.js").then((n) => n._);
2026
2026
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2027
2027
  } catch {
2028
2028
  return null;
@@ -2803,7 +2803,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
2803
2803
  }
2804
2804
  let fetchUrl = imageUrl;
2805
2805
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
2806
- const { isPrivateUrl } = await import("./index-D7cGwzxX.js").then((n) => n.Z);
2806
+ const { isPrivateUrl } = await import("./index-D-lngEWM.js").then((n) => n._);
2807
2807
  if (isPrivateUrl(imageUrl)) return null;
2808
2808
  const proxyUrl = new URL(`${API_URL}/image-proxy`);
2809
2809
  proxyUrl.searchParams.set("url", imageUrl);
@@ -4556,14 +4556,12 @@ async function exportMultiPagePdf(pages, options) {
4556
4556
  const liveCanvasForPage = page.pageId ? getCanvasForPage(page.pageId) : null;
4557
4557
  let allowLiveCanvasFallback = !!liveCanvasForPage;
4558
4558
  if (liveCanvasForPage) {
4559
- let previousSvgViewportTransformation;
4560
- let previousViewportTransform;
4561
4559
  try {
4562
- previousSvgViewportTransformation = liveCanvasForPage.svgViewportTransformation;
4563
- previousViewportTransform = liveCanvasForPage.viewportTransform ? [...liveCanvasForPage.viewportTransform] : void 0;
4564
- liveCanvasForPage.viewportTransform = [1, 0, 0, 1, 0, 0];
4565
- liveCanvasForPage.svgViewportTransformation = true;
4566
- const liveSvgString = liveCanvasForPage.toSVG();
4560
+ const liveSvgString = captureFabricCanvasSvgForPdf(
4561
+ liveCanvasForPage,
4562
+ page.width,
4563
+ page.height
4564
+ );
4567
4565
  const liveSvgWidth = page.width;
4568
4566
  const liveSvgHeight = page.height;
4569
4567
  const liveSvg = await prepareLiveCanvasSvgForPdf(
@@ -4598,11 +4596,6 @@ async function exportMultiPagePdf(pages, options) {
4598
4596
  } catch (error) {
4599
4597
  allowLiveCanvasFallback = false;
4600
4598
  console.error(`[client-pdf-export] live SVG export failed for page ${pageIndex + 1}`, error);
4601
- } finally {
4602
- liveCanvasForPage.svgViewportTransformation = previousSvgViewportTransformation;
4603
- if (previousViewportTransform) {
4604
- liveCanvasForPage.viewportTransform = previousViewportTransform;
4605
- }
4606
4599
  }
4607
4600
  }
4608
4601
  const matrixByElementId = /* @__PURE__ */ new Map();
@@ -4786,4 +4779,4 @@ export {
4786
4779
  preparePagesForExport,
4787
4780
  rewriteSvgFontsForJsPDFWithSourceMeta
4788
4781
  };
4789
- //# sourceMappingURL=vectorPdfExport-BBV3abJi.js.map
4782
+ //# sourceMappingURL=vectorPdfExport-ix7Z1pGO.js.map