@pixldocs/canvas-renderer 0.5.92 → 0.5.93

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.
package/dist/index.js CHANGED
@@ -12245,44 +12245,19 @@ function extractSectionStateCandidate(values, sections) {
12245
12245
  const looksLikeSectionState = Object.keys(raw).some((key) => sectionIds.has(key) || key.startsWith("section_"));
12246
12246
  return looksLikeSectionState ? raw : null;
12247
12247
  }
12248
- function entryIdentityTokens(entry, section) {
12249
- const entryNameKey = section == null ? void 0 : section.entryNameFieldKey;
12250
- const candidates = [
12251
- entry[ENTRY_NAME_KEY],
12252
- entryNameKey ? entry[entryNameKey] : void 0,
12253
- entry.section_title,
12254
- entry.label,
12255
- entry.name
12256
- ];
12257
- return Array.from(new Set(
12258
- candidates.filter((value) => typeof value === "string" && !!value.trim()).map((value) => value.trim().toLowerCase())
12259
- ));
12260
- }
12261
12248
  function mergeRepeatableEntryMeta(target, metaSource, sections) {
12262
12249
  if (!metaSource) return target;
12263
12250
  let changed = false;
12264
12251
  const next = { ...target };
12265
12252
  const repeatableIds = new Set(sections.filter((section) => section.type === "repeatable").map((section) => section.id));
12266
12253
  const isRepeatableStateKey = (key) => repeatableIds.has(key) || Array.from(repeatableIds).some((id) => key.endsWith(`_${id}`));
12267
- const sectionForStateKey = (key) => sections.find((section) => section.type === "repeatable" && (section.id === key || key.endsWith(`_${section.id}`)));
12268
12254
  for (const [key, targetEntries] of Object.entries(target)) {
12269
12255
  if (!isRepeatableStateKey(key) || !Array.isArray(targetEntries)) continue;
12270
12256
  const sourceEntries = metaSource[key];
12271
12257
  if (!Array.isArray(sourceEntries)) continue;
12272
- const section = sectionForStateKey(key);
12273
- const sourceByToken = /* @__PURE__ */ new Map();
12274
- const duplicateTokens = /* @__PURE__ */ new Set();
12275
- for (const sourceEntry of sourceEntries) {
12276
- if (!isRecord(sourceEntry)) continue;
12277
- for (const token of entryIdentityTokens(sourceEntry, section)) {
12278
- if (sourceByToken.has(token)) duplicateTokens.add(token);
12279
- else sourceByToken.set(token, sourceEntry);
12280
- }
12281
- }
12282
- for (const token of duplicateTokens) sourceByToken.delete(token);
12283
12258
  const mergedEntries = targetEntries.map((entry, index) => {
12284
12259
  if (!isRecord(entry)) return entry;
12285
- const sourceEntry = entryIdentityTokens(entry, section).map((token) => sourceByToken.get(token)).find((match) => !!match) ?? sourceEntries[index];
12260
+ const sourceEntry = sourceEntries[index];
12286
12261
  if (!isRecord(sourceEntry)) return entry;
12287
12262
  const id = sourceEntry[ENTRY_ID_KEY];
12288
12263
  const name = sourceEntry[ENTRY_NAME_KEY];