@pixldocs/canvas-renderer 0.5.459 → 0.5.461

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.
@@ -17096,13 +17096,15 @@ const PageCanvas = forwardRef(
17096
17096
  }
17097
17097
  updateElement(elementId, {
17098
17098
  text: newText,
17099
- ...typeof nextHeight === "number" && nextHeight > 0 && { height: nextHeight }
17099
+ ...typeof nextHeight === "number" && nextHeight > 0 && { height: nextHeight },
17100
+ ...target.styles && Object.keys(target.styles).length > 0 ? { styles: JSON.parse(JSON.stringify(target.styles)) } : {}
17100
17101
  });
17101
17102
  } else {
17102
17103
  updateElement(elementId, {
17103
17104
  text: newText,
17104
17105
  ...fabricHeight > 0 && { height: fabricHeight },
17105
- ...fabricWidth > 0 && { width: fabricWidth }
17106
+ ...fabricWidth > 0 && { width: fabricWidth },
17107
+ ...target.styles && Object.keys(target.styles).length > 0 ? { styles: JSON.parse(JSON.stringify(target.styles)) } : {}
17106
17108
  });
17107
17109
  }
17108
17110
  commitHistory2();
@@ -21074,10 +21076,19 @@ function applyTextCase(text, textCase) {
21074
21076
  function hasInlineFormattingMarkers(value) {
21075
21077
  return /\*\*[\s\S]+?\*\*|__[\s\S]+?__|~~[\s\S]+?~~|==[\s\S]+?==|\[(?:c|bg)=[^\]]+\][\s\S]+?\[\/(?:c|bg)\]|(^|[^*])\*[^*\n]+?\*/i.test(value);
21076
21078
  }
21077
- function setInTree(nodes, elementId, targetProperty, value) {
21079
+ function setInTree(nodes, elementId, targetProperty, value, svgColorKey) {
21078
21080
  for (const node of nodes) {
21079
21081
  if (node.id === elementId) {
21080
- if (targetProperty === "link") {
21082
+ if (svgColorKey) {
21083
+ const next = { ...node.svgColorMap || {} };
21084
+ const v = typeof value === "string" ? value.trim() : "";
21085
+ if (!v || v.toLowerCase() === String(svgColorKey).toLowerCase()) {
21086
+ delete next[svgColorKey];
21087
+ } else {
21088
+ next[svgColorKey] = v;
21089
+ }
21090
+ node.svgColorMap = Object.keys(next).length > 0 ? next : void 0;
21091
+ } else if (targetProperty === "link") {
21081
21092
  node.linkConfig = { ...node.linkConfig || {}, url: String(value ?? "") };
21082
21093
  } else if (targetProperty.startsWith("smartProp:") && node.smartElementType) {
21083
21094
  const propKey = targetProperty.slice("smartProp:".length);
@@ -21139,7 +21150,7 @@ function setInTree(nodes, elementId, targetProperty, value) {
21139
21150
  return true;
21140
21151
  }
21141
21152
  if (node.children && Array.isArray(node.children)) {
21142
- if (setInTree(node.children, elementId, targetProperty, value)) return true;
21153
+ if (setInTree(node.children, elementId, targetProperty, value, svgColorKey)) return true;
21143
21154
  }
21144
21155
  }
21145
21156
  return false;
@@ -21775,7 +21786,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21775
21786
  }
21776
21787
  return void 0;
21777
21788
  }
21778
- const applyValue = (elementId, targetProperty, value, fieldKey) => {
21789
+ const applyValue = (elementId, targetProperty, value, fieldKey, svgColorKey) => {
21779
21790
  var _a3;
21780
21791
  const isTextLike = targetProperty === "text" || targetProperty === "content";
21781
21792
  const isImageLike = targetProperty === "src" || targetProperty === "imageUrl";
@@ -21817,7 +21828,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21817
21828
  }
21818
21829
  }
21819
21830
  for (const page of pages) {
21820
- if (page.children && setInTree(page.children, elementId, targetProperty, effectiveValue)) return true;
21831
+ if (page.children && setInTree(page.children, elementId, targetProperty, effectiveValue, svgColorKey)) return true;
21821
21832
  }
21822
21833
  return false;
21823
21834
  };
@@ -21886,7 +21897,8 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21886
21897
  }
21887
21898
  if (!elementIds || elementIds.length === 0) continue;
21888
21899
  const targetProperty = mapping.targetProperty || "text";
21889
- for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key);
21900
+ const mSvgColorKey = mapping.svgColorKey;
21901
+ for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key, mSvgColorKey);
21890
21902
  }
21891
21903
  }
21892
21904
  }
@@ -21931,7 +21943,8 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21931
21943
  }
21932
21944
  if (elementIds.size === 0) continue;
21933
21945
  const targetProperty = mapping.targetProperty || "text";
21934
- for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key);
21946
+ const mSvgColorKey = mapping.svgColorKey;
21947
+ for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key, mSvgColorKey);
21935
21948
  }
21936
21949
  }
21937
21950
  }
@@ -21941,7 +21954,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21941
21954
  for (const m of mappings) {
21942
21955
  if (repeatableKeySet.has(m.field_key)) continue;
21943
21956
  const value = formValues[m.field_key];
21944
- applyValue(m.element_id, m.target_property, value, m.field_key);
21957
+ applyValue(m.element_id, m.target_property, value, m.field_key, m.svg_color_key);
21945
21958
  }
21946
21959
  if ((repeatablePagesFromSchema == null ? void 0 : repeatablePagesFromSchema.length) && (dynamicFields == null ? void 0 : dynamicFields.length)) {
21947
21960
  const findInPage = (page, originalId) => {
@@ -21976,10 +21989,11 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21976
21989
  for (const m of field.mappings ?? []) {
21977
21990
  const originalId = m.elementId;
21978
21991
  const targetProperty = m.targetProperty || "text";
21992
+ const mSvgColorKey = m.svgColorKey;
21979
21993
  if (!originalId) continue;
21980
21994
  const resolvedId = findInPage(page, originalId);
21981
21995
  if (!resolvedId) continue;
21982
- if (page.children) setInTree(page.children, resolvedId, targetProperty, value);
21996
+ if (page.children) setInTree(page.children, resolvedId, targetProperty, value, mSvgColorKey);
21983
21997
  }
21984
21998
  }
21985
21999
  }
@@ -26209,9 +26223,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26209
26223
  }
26210
26224
  return svgString;
26211
26225
  }
26212
- const resolvedPackageVersion = "0.5.459";
26226
+ const resolvedPackageVersion = "0.5.461";
26213
26227
  const PACKAGE_VERSION = resolvedPackageVersion;
26214
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.459";
26228
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.461";
26215
26229
  const roundParityValue = (value) => {
26216
26230
  if (typeof value !== "number") return value;
26217
26231
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27025,7 +27039,7 @@ class PixldocsRenderer {
27025
27039
  await this.waitForCanvasScene(container, cloned, i);
27026
27040
  }
27027
27041
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27028
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-De64EUqT.js");
27042
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bn1wgD8Q.js");
27029
27043
  const prepared = preparePagesForExport(
27030
27044
  cloned.pages,
27031
27045
  canvasWidth,
@@ -29345,7 +29359,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29345
29359
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29346
29360
  sanitizeSvgTreeForPdf(svgToDraw);
29347
29361
  try {
29348
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-De64EUqT.js");
29362
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bn1wgD8Q.js");
29349
29363
  try {
29350
29364
  await logTextMeasurementDiagnostic(svgToDraw);
29351
29365
  } catch {
@@ -29662,4 +29676,4 @@ export {
29662
29676
  buildTeaserBlurFlatKeys as y,
29663
29677
  collectFontDescriptorsFromConfig as z
29664
29678
  };
29665
- //# sourceMappingURL=index-BzvyPXLB.js.map
29679
+ //# sourceMappingURL=index-COG7WTYO.js.map