@pixldocs/canvas-renderer 0.5.139 → 0.5.141

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.
@@ -14894,7 +14894,7 @@ function collectFontsFromConfig(config) {
14894
14894
  }
14895
14895
  return fonts;
14896
14896
  }
14897
- function collectFontDescriptorsFromConfig(config) {
14897
+ function collectFontDescriptorsFromConfig(config, includeCommonTextVariants = true) {
14898
14898
  var _a;
14899
14899
  const seen = /* @__PURE__ */ new Set();
14900
14900
  const descriptors = [];
@@ -14914,7 +14914,7 @@ function collectFontDescriptorsFromConfig(config) {
14914
14914
  for (const node of nodes) {
14915
14915
  if (node.fontFamily) {
14916
14916
  add(node.fontFamily, node.fontWeight, node.fontStyle);
14917
- if (node.type === "text") {
14917
+ if (includeCommonTextVariants && node.type === "text") {
14918
14918
  for (const w of [300, 400, 500, 600, 700]) {
14919
14919
  add(node.fontFamily, w, node.fontStyle);
14920
14920
  add(node.fontFamily, w, "italic");
@@ -14974,12 +14974,19 @@ function collectFontDescriptorsFromConfig(config) {
14974
14974
  }
14975
14975
  async function ensureFontsForResolvedConfig(config) {
14976
14976
  if (typeof document === "undefined") return;
14977
- const descriptors = collectFontDescriptorsFromConfig(config);
14977
+ const descriptors = collectFontDescriptorsFromConfig(config, false);
14978
14978
  const families = new Set(descriptors.map((d) => d.family));
14979
- await withTimeout(Promise.all([...families].map((f) => loadGoogleFontCSS(f))), 3500);
14980
- await withTimeout(Promise.all(
14981
- descriptors.map((d) => registerRemoteFontFaceViaProxy(d.family, d.weight, d.style))
14982
- ), 5e3);
14979
+ const proxyOutcomes = await withTimeout(Promise.all(
14980
+ descriptors.map(async (d) => ({ family: d.family, ok: await registerRemoteFontFaceViaProxy(d.family, d.weight, d.style) }))
14981
+ ), 9e3);
14982
+ const proxyLoadedFamilies = new Set((proxyOutcomes || []).filter((r) => r.ok).map((r) => r.family));
14983
+ await withTimeout(Promise.all([...families].map((f) => {
14984
+ if (proxyLoadedFamilies.has(f)) {
14985
+ loadedFonts.add(f);
14986
+ return Promise.resolve();
14987
+ }
14988
+ return loadGoogleFontCSS(f);
14989
+ })), 3500);
14983
14990
  if (document.fonts) {
14984
14991
  descriptors.forEach((d) => {
14985
14992
  const stylePrefix = d.style === "italic" ? "italic " : "";
@@ -15009,7 +15016,7 @@ function configHasAutoShrinkText$1(config) {
15009
15016
  async function awaitFontsForConfig(config, maxWaitMs) {
15010
15017
  if (typeof document === "undefined" || !document.fonts) return;
15011
15018
  await ensureFontsForResolvedConfig(config);
15012
- const descriptors = collectFontDescriptorsFromConfig(config);
15019
+ const descriptors = collectFontDescriptorsFromConfig(config, false);
15013
15020
  if (descriptors.length === 0) return;
15014
15021
  const overallBudget = Math.max(maxWaitMs, 5e3);
15015
15022
  const loads = Promise.all(
@@ -15967,7 +15974,7 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
15967
15974
  }
15968
15975
  return svgString;
15969
15976
  }
15970
- const PACKAGE_VERSION = "0.5.138";
15977
+ const PACKAGE_VERSION = "0.5.141";
15971
15978
  const roundParityValue = (value) => {
15972
15979
  if (typeof value !== "number") return value;
15973
15980
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -16392,7 +16399,7 @@ class PixldocsRenderer {
16392
16399
  await this.waitForCanvasScene(container, cloned, i);
16393
16400
  }
16394
16401
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16395
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-GD7LeQPa.cjs"));
16402
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-v46WzRNa.cjs"));
16396
16403
  const prepared = preparePagesForExport(
16397
16404
  cloned.pages,
16398
16405
  canvasWidth,
@@ -16989,7 +16996,7 @@ class PixldocsRenderer {
16989
16996
  maxLineWidth: lineWidths.length ? Math.max(...lineWidths) : 0
16990
16997
  });
16991
16998
  }
16992
- if (obj instanceof fabric__namespace.Group && typeof obj.getObjects === "function") {
16999
+ if (isFabricGroupLike(obj)) {
16993
17000
  const nextPath = [groupPath, getObjectId(obj) || obj.type || "group"].filter(Boolean).join("/");
16994
17001
  obj.getObjects().forEach((child) => visit(child, nextPath));
16995
17002
  }
@@ -17008,7 +17015,7 @@ class PixldocsRenderer {
17008
17015
  this.logFabricTextParitySnapshot("before-stable-text-metrics", fabricInstance);
17009
17016
  const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
17010
17017
  const primeCharBounds = (obj) => {
17011
- if (obj instanceof fabric__namespace.Textbox) {
17018
+ if (isFabricTextboxLike(obj)) {
17012
17019
  try {
17013
17020
  obj.__lineWidths = [];
17014
17021
  obj.__lineHeights = [];
@@ -18490,7 +18497,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18490
18497
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18491
18498
  sanitizeSvgTreeForPdf(svgToDraw);
18492
18499
  try {
18493
- const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-GD7LeQPa.cjs"));
18500
+ const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-v46WzRNa.cjs"));
18494
18501
  await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
18495
18502
  } catch (e) {
18496
18503
  console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
@@ -18621,7 +18628,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
18621
18628
  }
18622
18629
  if (shouldOutlineText) {
18623
18630
  try {
18624
- const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-GeR0CexD.cjs"));
18631
+ const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-DolCNU9g.cjs"));
18625
18632
  pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl, { mode: outlineSubMode });
18626
18633
  try {
18627
18634
  dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");
@@ -18832,4 +18839,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
18832
18839
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
18833
18840
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
18834
18841
  exports.warmTemplateFromForm = warmTemplateFromForm;
18835
- //# sourceMappingURL=index-nnyTwr9Y.cjs.map
18842
+ //# sourceMappingURL=index-auyDeEWG.cjs.map