@pixldocs/canvas-renderer 0.5.141 → 0.5.143

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-auyDeEWG.cjs");
3
+ const index = require("./index-r5VzSOHa.cjs");
4
4
  exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
5
5
  exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
6
6
  exports.FONT_FALLBACK_SYMBOLS = index.FONT_FALLBACK_SYMBOLS;
package/dist/index.d.ts CHANGED
@@ -259,7 +259,7 @@ export declare function normalizeFontFamily(fontStack: string): string;
259
259
  * Package version banner. Bump alongside package.json so we can confirm
260
260
  * (via browser:log) that the deployed bundle matches the expected build.
261
261
  */
262
- export declare const PACKAGE_VERSION = "0.5.141";
262
+ export declare const PACKAGE_VERSION = "0.5.143";
263
263
 
264
264
  export declare interface PageSettings {
265
265
  backgroundColor?: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { F, o, q, s, P, t, u, v, w, x, y, z, B, C, D, E, G, H, I, J, K, b, L, M, N, O, Q, R, S, U, V, W, X, Y, Z } from "./index-DA3Nf1nG.js";
1
+ import { F, o, q, s, P, t, u, v, w, x, y, z, B, C, D, E, G, H, I, J, K, b, L, M, N, O, Q, R, S, U, V, W, X, Y, Z } from "./index-CUpy7HO9.js";
2
2
  export {
3
3
  F as FONT_FALLBACK_DEVANAGARI,
4
4
  o as FONT_FALLBACK_MATH,
@@ -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-DA3Nf1nG.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-CUpy7HO9.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;
@@ -1107,7 +1107,28 @@ async function bakeTextAnchorPositionsFromLiveSvg(svg) {
1107
1107
  }
1108
1108
  if (!needsBake) return;
1109
1109
  try {
1110
- if ((_a = document.fonts) == null ? void 0 : _a.ready) await document.fonts.ready;
1110
+ if (document.fonts) {
1111
+ const loadKeys = /* @__PURE__ */ new Set();
1112
+ for (const tn of svg.querySelectorAll("text, tspan, textPath")) {
1113
+ const ff = tn.getAttribute("data-source-font-family") || tn.getAttribute("font-family");
1114
+ if (!ff) continue;
1115
+ const fw = tn.getAttribute("data-source-font-weight") || tn.getAttribute("font-weight") || "400";
1116
+ const fs = tn.getAttribute("data-source-font-style") || tn.getAttribute("font-style") || "normal";
1117
+ const cleanFamily = ff.replace(/['"]/g, "").trim();
1118
+ if (!cleanFamily) continue;
1119
+ loadKeys.add(`${fs} ${fw} 16px "${cleanFamily}"`);
1120
+ }
1121
+ const loads = [];
1122
+ for (const spec of loadKeys) {
1123
+ try {
1124
+ loads.push(document.fonts.load(spec).catch(() => {
1125
+ }));
1126
+ } catch {
1127
+ }
1128
+ }
1129
+ if (loads.length > 0) await Promise.all(loads);
1130
+ if ((_a = document.fonts) == null ? void 0 : _a.ready) await document.fonts.ready;
1131
+ }
1111
1132
  } catch {
1112
1133
  }
1113
1134
  const tempContainer = document.createElement("div");
@@ -2227,7 +2248,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
2227
2248
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
2228
2249
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
2229
2250
  try {
2230
- const { getNormalizedSvgUrl } = await import("./index-DA3Nf1nG.js").then((n) => n._);
2251
+ const { getNormalizedSvgUrl } = await import("./index-CUpy7HO9.js").then((n) => n._);
2231
2252
  return await getNormalizedSvgUrl(imageUrl, colorMap);
2232
2253
  } catch {
2233
2254
  return null;
@@ -3008,7 +3029,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
3008
3029
  }
3009
3030
  let fetchUrl = imageUrl;
3010
3031
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
3011
- const { isPrivateUrl } = await import("./index-DA3Nf1nG.js").then((n) => n._);
3032
+ const { isPrivateUrl } = await import("./index-CUpy7HO9.js").then((n) => n._);
3012
3033
  if (isPrivateUrl(imageUrl)) return null;
3013
3034
  const proxyUrl = new URL(`${API_URL}/image-proxy`);
3014
3035
  proxyUrl.searchParams.set("url", imageUrl);
@@ -4991,4 +5012,4 @@ export {
4991
5012
  preparePagesForExport,
4992
5013
  rewriteSvgFontsForJsPDFWithSourceMeta
4993
5014
  };
4994
- //# sourceMappingURL=vectorPdfExport-Bkg5qekb.js.map
5015
+ //# sourceMappingURL=vectorPdfExport-GvaizFte.js.map