Add goal tree toolbox module
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s

This commit is contained in:
Shinuwa 2026-08-22 18:15:39 +02:00
parent e4cbe3e087
commit 59fdcb0927
63 changed files with 4062 additions and 252 deletions

View file

@ -10,6 +10,7 @@ export { normalizeCombosData } from "./modules/combos.js";
export { normalizeCountersData } from "./modules/counters.js";
export { normalizeDrawingData } from "./modules/drawing.js";
export { normalizeEquipmentPlannerData, summarizeEquipmentPlannerData } from "./modules/equipmentPlanner.js";
export { normalizeGoalTreeData } from "./modules/goalTree.js";
export { labelFromFileName, normalizeImageAnnotationData } from "./modules/imageAnnotation.js";
export { hostnameFromUrl, normalizeLinksData, normalizeUrl } from "./modules/links.js";
export { normalizeNotepadData, sanitizeNotepadHtml } from "./modules/notepad.js";
@ -275,6 +276,22 @@ function remapModuleDataForExport(type, data, nextId) {
return remapped;
}
if (type === "goalTree") {
const nodeIdMap = new Map();
compact.nodes?.forEach((node) => nodeIdMap.set(node.id, nextId("goal")));
const remapped = { ...compact };
if (compact.nodes) {
remapped.nodes = compact.nodes.map((node) => {
const nextNode = { ...node, id: nodeIdMap.get(node.id) };
if (node.parentId) nextNode.parentId = nodeIdMap.get(node.parentId) || "";
if (node.parentIds) nextNode.parentIds = node.parentIds.map((parentId) => nodeIdMap.get(parentId)).filter(Boolean);
if (node.items) nextNode.items = node.items.map((item) => ({ ...item, id: nextId("goal") }));
return nextNode;
});
}
return remapped;
}
if (type === "equipmentPlanner") {
const typeIdMap = new Map();
const equipmentIdMap = new Map();