@vectoriox/iox-builder 10.1.1 → 10.1.2
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.
|
@@ -1100,6 +1100,21 @@ function regenerateNodeIds(root, opts = {}) {
|
|
|
1100
1100
|
};
|
|
1101
1101
|
assign(root);
|
|
1102
1102
|
remapNodeReferences(root, idMap);
|
|
1103
|
+
remapItemKeyTraits(root, keyMap);
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Traits whose value NAMES an item by its key (CC4b: a Segmented control's On by default). The keys are reissued per
|
|
1107
|
+
* copy above, so the value follows them — else a pasted or inserted control defaults to a key none of its options holds.
|
|
1108
|
+
*/
|
|
1109
|
+
const ITEM_KEY_TRAITS = new Set(['defaultOn']);
|
|
1110
|
+
function remapItemKeyTraits(node, keyMap) {
|
|
1111
|
+
if (!keyMap.size)
|
|
1112
|
+
return;
|
|
1113
|
+
for (const trait of (node.traits ?? [])) {
|
|
1114
|
+
if (trait?.name && ITEM_KEY_TRAITS.has(trait.name) && keyMap.has(trait.default))
|
|
1115
|
+
trait.default = keyMap.get(trait.default);
|
|
1116
|
+
}
|
|
1117
|
+
(node.children || []).forEach(child => remapItemKeyTraits(child, keyMap));
|
|
1103
1118
|
}
|
|
1104
1119
|
/** Remap absolute node-id references inside a subtree to their new ids (per `idMap`). Ids not in
|
|
1105
1120
|
* the map (references to nodes outside the cloned subtree) are preserved. */
|