@pixldocs/canvas-renderer 0.5.203 → 0.5.204

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.
@@ -13143,22 +13143,35 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
13143
13143
  }
13144
13144
  return false;
13145
13145
  };
13146
- const getFieldForRepeatableKey = (fieldId, fullKey) => {
13147
- if (!(dynamicFields == null ? void 0 : dynamicFields.length)) return void 0;
13146
+ const getFieldsForRepeatableKey = (fieldId, fullKey) => {
13147
+ if (!(dynamicFields == null ? void 0 : dynamicFields.length)) return [];
13148
+ const matches = [];
13149
+ const add = (field) => {
13150
+ if (field && !matches.some((existing) => existing.id === field.id)) matches.push(field);
13151
+ };
13148
13152
  if (fullKey) {
13149
- const byFullId = dynamicFields.find((f) => f.id === fullKey);
13150
- if (byFullId) return byFullId;
13151
- }
13152
- const byId = dynamicFields.find((f) => f.id === fieldId);
13153
- if (byId) return byId;
13154
- const byElementId = dynamicFields.find((f) => (f.mappings ?? []).some((m) => (m == null ? void 0 : m.elementId) === fieldId));
13155
- if (byElementId) return byElementId;
13156
- const suffixMatch = dynamicFields.find((f) => {
13157
- if (f.id.endsWith(`_N_${fieldId}`)) return true;
13158
- if (f.id.endsWith(`_${fieldId}`) && f.id.includes("_N_")) return true;
13159
- return false;
13160
- });
13161
- return suffixMatch;
13153
+ add(dynamicFields.find((f) => f.id === fullKey));
13154
+ const nestedMatch = fullKey.match(NESTED_REPEATABLE_KEY_REGEX);
13155
+ if (nestedMatch) {
13156
+ const [, parentId, , childId, , suffix] = nestedMatch;
13157
+ add(dynamicFields.find((f) => f.id === `field_${parentId}_N_field_${childId}_N_${suffix}`));
13158
+ } else {
13159
+ const match = fullKey.match(REPEATABLE_KEY_REGEX);
13160
+ if (match) {
13161
+ const [, nodeId, , suffix] = match;
13162
+ add(dynamicFields.find((f) => f.id === `field_${nodeId}_N_${suffix}`));
13163
+ }
13164
+ }
13165
+ }
13166
+ add(dynamicFields.find((f) => f.id === fieldId));
13167
+ for (const f of dynamicFields) {
13168
+ if ((f.mappings ?? []).some((m) => (m == null ? void 0 : m.elementId) === fieldId)) add(f);
13169
+ }
13170
+ for (const f of dynamicFields) {
13171
+ if (f.id.endsWith(`_N_${fieldId}`)) add(f);
13172
+ else if (f.id.endsWith(`_${fieldId}`) && f.id.includes("_N_")) add(f);
13173
+ }
13174
+ return matches;
13162
13175
  };
13163
13176
  if (dynamicFields == null ? void 0 : dynamicFields.length) {
13164
13177
  for (const key of Object.keys(formValues)) {
@@ -13166,8 +13179,8 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
13166
13179
  if (nestedMatch) {
13167
13180
  const [, parentId, parentIndexStr, childId, childIndexStr, fieldId] = nestedMatch;
13168
13181
  const value = formValues[key];
13169
- const field = getFieldForRepeatableKey(fieldId, key);
13170
- for (const mapping of (field == null ? void 0 : field.mappings) ?? []) {
13182
+ const fields = getFieldsForRepeatableKey(fieldId, key);
13183
+ for (const field of fields) for (const mapping of field.mappings ?? []) {
13171
13184
  const oldElementId = mapping.elementId;
13172
13185
  const mapKeyByElement = `${baseId(parentId)}_${parentIndexStr}_${baseId(childId)}_${childIndexStr}_${oldElementId}`;
13173
13186
  let elementIds = resolvedIdMap.get(mapKeyByElement);
@@ -13218,8 +13231,8 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
13218
13231
  if (!match) continue;
13219
13232
  const [, nodeId, indexStr, fieldId] = match;
13220
13233
  const value = formValues[key];
13221
- const field = getFieldForRepeatableKey(fieldId);
13222
- for (const mapping of (field == null ? void 0 : field.mappings) ?? []) {
13234
+ const fields = getFieldsForRepeatableKey(fieldId, key);
13235
+ for (const field of fields) for (const mapping of field.mappings ?? []) {
13223
13236
  const oldElementId = mapping.elementId;
13224
13237
  const elementIds = /* @__PURE__ */ new Set();
13225
13238
  for (const candidateBaseId of getRepeatableBaseIdsForToken(nodeId)) {
@@ -15863,11 +15876,17 @@ async function resolveFromForm(options) {
15863
15876
  }
15864
15877
  return void 0;
15865
15878
  };
15879
+ const entryMetaForLabel = (label) => {
15880
+ const normalized = label.trim().toLowerCase();
15881
+ const item = inferredRepeatableList.find((candidate) => candidate.label.trim().toLowerCase() === normalized);
15882
+ return { entryMeta: item == null ? void 0 : item.entryMeta, nestedEntryMeta: item == null ? void 0 : item.nestedEntryMeta };
15883
+ };
15866
15884
  const fallbackRepeatableList = (repeatableFromSchema ?? []).map((r) => ({
15867
15885
  nodeId: r.nodeId,
15868
15886
  label: r.label,
15869
15887
  entryFilter: r.entryFilter,
15870
- entryCount: entryCountForLabel(r.label)
15888
+ entryCount: entryCountForLabel(r.label),
15889
+ ...entryMetaForLabel(r.label)
15871
15890
  }));
15872
15891
  const repeatableList = inferredRepeatableList.length > 0 ? [
15873
15892
  ...inferredRepeatableList,
@@ -16931,9 +16950,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
16931
16950
  }
16932
16951
  return svgString;
16933
16952
  }
16934
- const resolvedPackageVersion = "0.5.203";
16953
+ const resolvedPackageVersion = "0.5.204";
16935
16954
  const PACKAGE_VERSION = resolvedPackageVersion;
16936
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.203";
16955
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.204";
16937
16956
  const roundParityValue = (value) => {
16938
16957
  if (typeof value !== "number") return value;
16939
16958
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -17612,7 +17631,7 @@ class PixldocsRenderer {
17612
17631
  await this.waitForCanvasScene(container, cloned, i);
17613
17632
  }
17614
17633
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
17615
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B8tazQjy.js");
17634
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-NpBdL1eb.js");
17616
17635
  const prepared = preparePagesForExport(
17617
17636
  cloned.pages,
17618
17637
  canvasWidth,
@@ -19796,7 +19815,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
19796
19815
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
19797
19816
  sanitizeSvgTreeForPdf(svgToDraw);
19798
19817
  try {
19799
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B8tazQjy.js");
19818
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-NpBdL1eb.js");
19800
19819
  try {
19801
19820
  await logTextMeasurementDiagnostic(svgToDraw);
19802
19821
  } catch {
@@ -20196,4 +20215,4 @@ export {
20196
20215
  buildTeaserBlurFlatKeys as y,
20197
20216
  collectFontDescriptorsFromConfig as z
20198
20217
  };
20199
- //# sourceMappingURL=index-C2gJ23dU.js.map
20218
+ //# sourceMappingURL=index-BfLA9Iqt.js.map