@pixldocs/canvas-renderer 0.5.453 → 0.5.455

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.
@@ -20973,6 +20973,20 @@ function flattenSectionStateToFormData(sectionState, sections) {
20973
20973
  }
20974
20974
  return flat;
20975
20975
  }
20976
+ function gradientSiblingForTarget(targetProperty) {
20977
+ switch (targetProperty) {
20978
+ case "fill":
20979
+ return "fillGradient";
20980
+ case "stroke":
20981
+ return "strokeGradient";
20982
+ case "textBgColor":
20983
+ return "textBgGradient";
20984
+ case "backgroundColor":
20985
+ return "backgroundGradient";
20986
+ default:
20987
+ return null;
20988
+ }
20989
+ }
20976
20990
  const CLONE_SUFFIX = /_\d+$/;
20977
20991
  function baseId(id) {
20978
20992
  let s = id;
@@ -21045,6 +21059,9 @@ function applyTextCase(text, textCase) {
21045
21059
  return text;
21046
21060
  }
21047
21061
  }
21062
+ function hasInlineFormattingMarkers(value) {
21063
+ return /\*\*[\s\S]+?\*\*|__[\s\S]+?__|~~[\s\S]+?~~|==[\s\S]+?==|\[(?:c|bg)=[^\]]+\][\s\S]+?\[\/(?:c|bg)\]|(^|[^*])\*[^*\n]+?\*/i.test(value);
21064
+ }
21048
21065
  function setInTree(nodes, elementId, targetProperty, value) {
21049
21066
  for (const node of nodes) {
21050
21067
  if (node.id === elementId) {
@@ -21059,6 +21076,9 @@ function setInTree(nodes, elementId, targetProperty, value) {
21059
21076
  } else if (targetProperty === "text" && node.type === "text" && typeof value === "string") {
21060
21077
  const textVal = value === "" ? " " : value;
21061
21078
  node[targetProperty] = applyTextCase(textVal, node.textCase);
21079
+ if (hasInlineFormattingMarkers(textVal)) {
21080
+ node.formattingEnabled = true;
21081
+ }
21062
21082
  } else if ((targetProperty === "src" || targetProperty === "imageUrl") && node.type === "image") {
21063
21083
  const previousSrc = String(node.src || node.imageUrl || "");
21064
21084
  const nextSrc = String(value ?? "");
@@ -21073,7 +21093,18 @@ function setInTree(nodes, elementId, targetProperty, value) {
21073
21093
  delete node.cropZoom;
21074
21094
  }
21075
21095
  } else {
21076
- node[targetProperty] = value;
21096
+ const gradSibling = gradientSiblingForTarget(targetProperty);
21097
+ if (gradSibling) {
21098
+ if (isGradientConfig(value)) {
21099
+ node[gradSibling] = value;
21100
+ node[targetProperty] = targetProperty === "textBgColor" ? "transparent" : "";
21101
+ } else {
21102
+ if (gradSibling in node) delete node[gradSibling];
21103
+ node[targetProperty] = value;
21104
+ }
21105
+ } else {
21106
+ node[targetProperty] = value;
21107
+ }
21077
21108
  }
21078
21109
  if (targetProperty === "text" && node.type === "text") {
21079
21110
  const overflowPolicy = String(node.overflowPolicy ?? "grow-and-push");
@@ -21745,10 +21776,19 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21745
21776
  effectiveValue = formatTimeForDisplay(effectiveValue);
21746
21777
  }
21747
21778
  }
21748
- if (elementId === PAGE_BACKGROUND_ELEMENT_ID && targetProperty === "backgroundColor" && typeof effectiveValue === "string") {
21779
+ if (elementId === PAGE_BACKGROUND_ELEMENT_ID && targetProperty === "backgroundColor") {
21749
21780
  if ((_a3 = pages[0]) == null ? void 0 : _a3.settings) {
21750
- pages[0].settings.backgroundColor = effectiveValue;
21751
- return true;
21781
+ const settings = pages[0].settings;
21782
+ if (isGradientConfig(effectiveValue)) {
21783
+ settings.backgroundGradient = effectiveValue;
21784
+ settings.backgroundColor = "";
21785
+ return true;
21786
+ }
21787
+ if (typeof effectiveValue === "string") {
21788
+ if ("backgroundGradient" in settings) delete settings.backgroundGradient;
21789
+ settings.backgroundColor = effectiveValue;
21790
+ return true;
21791
+ }
21752
21792
  }
21753
21793
  }
21754
21794
  for (const page of pages) {
@@ -25996,9 +26036,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25996
26036
  }
25997
26037
  return svgString;
25998
26038
  }
25999
- const resolvedPackageVersion = "0.5.453";
26039
+ const resolvedPackageVersion = "0.5.455";
26000
26040
  const PACKAGE_VERSION = resolvedPackageVersion;
26001
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.453";
26041
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.455";
26002
26042
  const roundParityValue = (value) => {
26003
26043
  if (typeof value !== "number") return value;
26004
26044
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26812,7 +26852,7 @@ class PixldocsRenderer {
26812
26852
  await this.waitForCanvasScene(container, cloned, i);
26813
26853
  }
26814
26854
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26815
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DA8kyWb1.js");
26855
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Dl1_fD7e.js");
26816
26856
  const prepared = preparePagesForExport(
26817
26857
  cloned.pages,
26818
26858
  canvasWidth,
@@ -29132,7 +29172,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29132
29172
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29133
29173
  sanitizeSvgTreeForPdf(svgToDraw);
29134
29174
  try {
29135
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DA8kyWb1.js");
29175
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Dl1_fD7e.js");
29136
29176
  try {
29137
29177
  await logTextMeasurementDiagnostic(svgToDraw);
29138
29178
  } catch {
@@ -29532,4 +29572,4 @@ export {
29532
29572
  buildTeaserBlurFlatKeys as y,
29533
29573
  collectFontDescriptorsFromConfig as z
29534
29574
  };
29535
- //# sourceMappingURL=index-B4ZctiMj.js.map
29575
+ //# sourceMappingURL=index-Bs4oHgQ2.js.map