@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.cjs +1 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12264,44 +12264,19 @@ function extractSectionStateCandidate(values, sections) {
|
|
|
12264
12264
|
const looksLikeSectionState = Object.keys(raw).some((key) => sectionIds.has(key) || key.startsWith("section_"));
|
|
12265
12265
|
return looksLikeSectionState ? raw : null;
|
|
12266
12266
|
}
|
|
12267
|
-
function entryIdentityTokens(entry, section) {
|
|
12268
|
-
const entryNameKey = section == null ? void 0 : section.entryNameFieldKey;
|
|
12269
|
-
const candidates = [
|
|
12270
|
-
entry[ENTRY_NAME_KEY],
|
|
12271
|
-
entryNameKey ? entry[entryNameKey] : void 0,
|
|
12272
|
-
entry.section_title,
|
|
12273
|
-
entry.label,
|
|
12274
|
-
entry.name
|
|
12275
|
-
];
|
|
12276
|
-
return Array.from(new Set(
|
|
12277
|
-
candidates.filter((value) => typeof value === "string" && !!value.trim()).map((value) => value.trim().toLowerCase())
|
|
12278
|
-
));
|
|
12279
|
-
}
|
|
12280
12267
|
function mergeRepeatableEntryMeta(target, metaSource, sections) {
|
|
12281
12268
|
if (!metaSource) return target;
|
|
12282
12269
|
let changed = false;
|
|
12283
12270
|
const next = { ...target };
|
|
12284
12271
|
const repeatableIds = new Set(sections.filter((section) => section.type === "repeatable").map((section) => section.id));
|
|
12285
12272
|
const isRepeatableStateKey = (key) => repeatableIds.has(key) || Array.from(repeatableIds).some((id) => key.endsWith(`_${id}`));
|
|
12286
|
-
const sectionForStateKey = (key) => sections.find((section) => section.type === "repeatable" && (section.id === key || key.endsWith(`_${section.id}`)));
|
|
12287
12273
|
for (const [key, targetEntries] of Object.entries(target)) {
|
|
12288
12274
|
if (!isRepeatableStateKey(key) || !Array.isArray(targetEntries)) continue;
|
|
12289
12275
|
const sourceEntries = metaSource[key];
|
|
12290
12276
|
if (!Array.isArray(sourceEntries)) continue;
|
|
12291
|
-
const section = sectionForStateKey(key);
|
|
12292
|
-
const sourceByToken = /* @__PURE__ */ new Map();
|
|
12293
|
-
const duplicateTokens = /* @__PURE__ */ new Set();
|
|
12294
|
-
for (const sourceEntry of sourceEntries) {
|
|
12295
|
-
if (!isRecord(sourceEntry)) continue;
|
|
12296
|
-
for (const token of entryIdentityTokens(sourceEntry, section)) {
|
|
12297
|
-
if (sourceByToken.has(token)) duplicateTokens.add(token);
|
|
12298
|
-
else sourceByToken.set(token, sourceEntry);
|
|
12299
|
-
}
|
|
12300
|
-
}
|
|
12301
|
-
for (const token of duplicateTokens) sourceByToken.delete(token);
|
|
12302
12277
|
const mergedEntries = targetEntries.map((entry, index) => {
|
|
12303
12278
|
if (!isRecord(entry)) return entry;
|
|
12304
|
-
const sourceEntry =
|
|
12279
|
+
const sourceEntry = sourceEntries[index];
|
|
12305
12280
|
if (!isRecord(sourceEntry)) return entry;
|
|
12306
12281
|
const id = sourceEntry[ENTRY_ID_KEY];
|
|
12307
12282
|
const name = sourceEntry[ENTRY_NAME_KEY];
|