@pixldocs/canvas-renderer 0.5.459 → 0.5.460

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.
@@ -21074,10 +21074,19 @@ function applyTextCase(text, textCase) {
21074
21074
  function hasInlineFormattingMarkers(value) {
21075
21075
  return /\*\*[\s\S]+?\*\*|__[\s\S]+?__|~~[\s\S]+?~~|==[\s\S]+?==|\[(?:c|bg)=[^\]]+\][\s\S]+?\[\/(?:c|bg)\]|(^|[^*])\*[^*\n]+?\*/i.test(value);
21076
21076
  }
21077
- function setInTree(nodes, elementId, targetProperty, value) {
21077
+ function setInTree(nodes, elementId, targetProperty, value, svgColorKey) {
21078
21078
  for (const node of nodes) {
21079
21079
  if (node.id === elementId) {
21080
- if (targetProperty === "link") {
21080
+ if (svgColorKey) {
21081
+ const next = { ...node.svgColorMap || {} };
21082
+ const v = typeof value === "string" ? value.trim() : "";
21083
+ if (!v || v.toLowerCase() === String(svgColorKey).toLowerCase()) {
21084
+ delete next[svgColorKey];
21085
+ } else {
21086
+ next[svgColorKey] = v;
21087
+ }
21088
+ node.svgColorMap = Object.keys(next).length > 0 ? next : void 0;
21089
+ } else if (targetProperty === "link") {
21081
21090
  node.linkConfig = { ...node.linkConfig || {}, url: String(value ?? "") };
21082
21091
  } else if (targetProperty.startsWith("smartProp:") && node.smartElementType) {
21083
21092
  const propKey = targetProperty.slice("smartProp:".length);
@@ -21139,7 +21148,7 @@ function setInTree(nodes, elementId, targetProperty, value) {
21139
21148
  return true;
21140
21149
  }
21141
21150
  if (node.children && Array.isArray(node.children)) {
21142
- if (setInTree(node.children, elementId, targetProperty, value)) return true;
21151
+ if (setInTree(node.children, elementId, targetProperty, value, svgColorKey)) return true;
21143
21152
  }
21144
21153
  }
21145
21154
  return false;
@@ -21775,7 +21784,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21775
21784
  }
21776
21785
  return void 0;
21777
21786
  }
21778
- const applyValue = (elementId, targetProperty, value, fieldKey) => {
21787
+ const applyValue = (elementId, targetProperty, value, fieldKey, svgColorKey) => {
21779
21788
  var _a3;
21780
21789
  const isTextLike = targetProperty === "text" || targetProperty === "content";
21781
21790
  const isImageLike = targetProperty === "src" || targetProperty === "imageUrl";
@@ -21817,7 +21826,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21817
21826
  }
21818
21827
  }
21819
21828
  for (const page of pages) {
21820
- if (page.children && setInTree(page.children, elementId, targetProperty, effectiveValue)) return true;
21829
+ if (page.children && setInTree(page.children, elementId, targetProperty, effectiveValue, svgColorKey)) return true;
21821
21830
  }
21822
21831
  return false;
21823
21832
  };
@@ -21886,7 +21895,8 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21886
21895
  }
21887
21896
  if (!elementIds || elementIds.length === 0) continue;
21888
21897
  const targetProperty = mapping.targetProperty || "text";
21889
- for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key);
21898
+ const mSvgColorKey = mapping.svgColorKey;
21899
+ for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key, mSvgColorKey);
21890
21900
  }
21891
21901
  }
21892
21902
  }
@@ -21931,7 +21941,8 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21931
21941
  }
21932
21942
  if (elementIds.size === 0) continue;
21933
21943
  const targetProperty = mapping.targetProperty || "text";
21934
- for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key);
21944
+ const mSvgColorKey = mapping.svgColorKey;
21945
+ for (const elementId of elementIds) applyValue(elementId, targetProperty, value, key, mSvgColorKey);
21935
21946
  }
21936
21947
  }
21937
21948
  }
@@ -21941,7 +21952,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21941
21952
  for (const m of mappings) {
21942
21953
  if (repeatableKeySet.has(m.field_key)) continue;
21943
21954
  const value = formValues[m.field_key];
21944
- applyValue(m.element_id, m.target_property, value, m.field_key);
21955
+ applyValue(m.element_id, m.target_property, value, m.field_key, m.svg_color_key);
21945
21956
  }
21946
21957
  if ((repeatablePagesFromSchema == null ? void 0 : repeatablePagesFromSchema.length) && (dynamicFields == null ? void 0 : dynamicFields.length)) {
21947
21958
  const findInPage = (page, originalId) => {
@@ -21976,10 +21987,11 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
21976
21987
  for (const m of field.mappings ?? []) {
21977
21988
  const originalId = m.elementId;
21978
21989
  const targetProperty = m.targetProperty || "text";
21990
+ const mSvgColorKey = m.svgColorKey;
21979
21991
  if (!originalId) continue;
21980
21992
  const resolvedId = findInPage(page, originalId);
21981
21993
  if (!resolvedId) continue;
21982
- if (page.children) setInTree(page.children, resolvedId, targetProperty, value);
21994
+ if (page.children) setInTree(page.children, resolvedId, targetProperty, value, mSvgColorKey);
21983
21995
  }
21984
21996
  }
21985
21997
  }
@@ -26209,9 +26221,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26209
26221
  }
26210
26222
  return svgString;
26211
26223
  }
26212
- const resolvedPackageVersion = "0.5.459";
26224
+ const resolvedPackageVersion = "0.5.460";
26213
26225
  const PACKAGE_VERSION = resolvedPackageVersion;
26214
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.459";
26226
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.460";
26215
26227
  const roundParityValue = (value) => {
26216
26228
  if (typeof value !== "number") return value;
26217
26229
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27025,7 +27037,7 @@ class PixldocsRenderer {
27025
27037
  await this.waitForCanvasScene(container, cloned, i);
27026
27038
  }
27027
27039
  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");
27040
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CWiNW81v.js");
27029
27041
  const prepared = preparePagesForExport(
27030
27042
  cloned.pages,
27031
27043
  canvasWidth,
@@ -29345,7 +29357,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29345
29357
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29346
29358
  sanitizeSvgTreeForPdf(svgToDraw);
29347
29359
  try {
29348
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-De64EUqT.js");
29360
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CWiNW81v.js");
29349
29361
  try {
29350
29362
  await logTextMeasurementDiagnostic(svgToDraw);
29351
29363
  } catch {
@@ -29662,4 +29674,4 @@ export {
29662
29674
  buildTeaserBlurFlatKeys as y,
29663
29675
  collectFontDescriptorsFromConfig as z
29664
29676
  };
29665
- //# sourceMappingURL=index-BzvyPXLB.js.map
29677
+ //# sourceMappingURL=index-B306IfvT.js.map