@lv-x-software-house/x_view 1.2.4-dev.6 → 1.2.4-dev.8

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
@@ -1559,7 +1559,7 @@ var addStandaloneNodeToScene = (state, nodeData, position) => {
1559
1559
  scaleTween.start();
1560
1560
  }
1561
1561
  };
1562
- var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
1562
+ var getParentFileInfoForNode = (allParentData, sceneData, nodeId, sceneConfigId = null, sceneOwnerId = null) => {
1563
1563
  const parentDbsArray = (sceneData == null ? void 0 : sceneData.parent_dbs) || [];
1564
1564
  for (const parentFileId in allParentData) {
1565
1565
  if (allParentData.hasOwnProperty(parentFileId)) {
@@ -1568,6 +1568,8 @@ var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
1568
1568
  const parentDbInfo = parentDbsArray.find((db) => String(db.db_id) === String(parentFileId));
1569
1569
  if (parentDbInfo) {
1570
1570
  return { parentFileId, ownerId: parentDbInfo.owner_id };
1571
+ } else if (sceneConfigId && String(parentFileId) === String(sceneConfigId)) {
1572
+ return { parentFileId, ownerId: sceneOwnerId };
1571
1573
  } else {
1572
1574
  console.warn(`Owner ID n\xE3o encontrado em sceneData.parent_dbs para o parentFileId: ${parentFileId}`);
1573
1575
  return { parentFileId, ownerId: null };
@@ -1846,7 +1848,7 @@ var userActionHandlers = {
1846
1848
  version_node: { is_version: true, parent_node: sourceNodeData.id }
1847
1849
  };
1848
1850
  const newLink = { id: `link_${import_short_uuid.default.generate()}`, source: sourceNodeData.id, target: newNode.id };
1849
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
1851
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
1850
1852
  if (!parentInfo || !parentInfo.ownerId) {
1851
1853
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
1852
1854
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
@@ -2022,7 +2024,7 @@ var userActionHandlers = {
2022
2024
  userActionHandlers.handleCancelConnection(context);
2023
2025
  return;
2024
2026
  }
2025
- const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
2027
+ const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
2026
2028
  if (!sourceParentInfo || !sourceParentInfo.ownerId) {
2027
2029
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
2028
2030
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
@@ -2111,8 +2113,8 @@ var userActionHandlers = {
2111
2113
  } else {
2112
2114
  newTargetId = newEndNodeData.id;
2113
2115
  }
2114
- const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId);
2115
- const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId);
2116
+ const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId, context.sceneConfigId, context.ownerId);
2117
+ const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId, context.sceneConfigId, context.ownerId);
2116
2118
  if (!originalParentInfo || !newParentInfo || !originalParentInfo.ownerId || !newParentInfo.ownerId) {
2117
2119
  console.error("N\xE3o foi poss\xEDvel encontrar informa\xE7\xF5es dos arquivos pai para o relink.");
2118
2120
  alert("Ocorreu um erro ao identificar os arquivos pai para salvar a altera\xE7\xE3o.");
@@ -2180,7 +2182,7 @@ var userActionHandlers = {
2180
2182
  console.error("Tentativa de deletar um link sem ID.", linkObject.userData);
2181
2183
  return;
2182
2184
  }
2183
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source);
2185
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source, context.sceneConfigId, context.ownerId);
2184
2186
  if (!parentInfo || !parentInfo.ownerId) {
2185
2187
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:", linkIdToDelete);
2186
2188
  alert("Ocorreu um erro ao identificar o arquivo pai da rela\xE7\xE3o para exclus\xE3o.");
@@ -2192,9 +2194,24 @@ var userActionHandlers = {
2192
2194
  const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
2193
2195
  const newLinks = (specificParentData.links || []).filter((l) => String(l.id) !== String(linkIdToDelete));
2194
2196
  specificParentData.links = newLinks;
2195
- const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2197
+ let filenameToSave;
2198
+ let payloadToSave;
2199
+ if (parentFileId === context.sceneConfigId) {
2200
+ filenameToSave = context.sceneSaveUrl;
2201
+ sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => String(l.id) !== String(linkIdToDelete));
2202
+ payloadToSave = {
2203
+ parent_dbs: sceneDataRef.current.parent_dbs,
2204
+ nodes: sceneDataRef.current.nodes,
2205
+ links: sceneDataRef.current.links,
2206
+ quest_nodes: specificParentData.nodes,
2207
+ quest_links: specificParentData.links
2208
+ };
2209
+ } else {
2210
+ filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
2211
+ payloadToSave = specificParentData;
2212
+ }
2196
2213
  try {
2197
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
2214
+ await context.actions.save_view_data(filenameToSave, payloadToSave);
2198
2215
  graphDataRef.current[parentFileId] = specificParentData;
2199
2216
  setters.setDetailsLink((prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev);
2200
2217
  if (stateRef.current.hoveredLink === linkObject) {
@@ -2357,7 +2374,7 @@ var userActionHandlers = {
2357
2374
  }
2358
2375
  const changesByParentFile = {};
2359
2376
  for (const nodeId of strNodeIdsToDelete) {
2360
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId);
2377
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId, context.sceneConfigId, context.ownerId);
2361
2378
  if (!parentInfo || !parentInfo.ownerId) {
2362
2379
  console.warn(`Node com ID ${nodeId} n\xE3o encontrado ou sem ownerId. Ignorando.`);
2363
2380
  continue;
@@ -2391,8 +2408,26 @@ var userActionHandlers = {
2391
2408
  originalData.links = (originalData.links || []).filter(
2392
2409
  (l) => !linksToDelete.has(String(l.id))
2393
2410
  );
2394
- const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2395
- savePromises.push(context.actions.save_view_data(filenameForSpecificParent, originalData));
2411
+ let filenameToSave;
2412
+ let payloadToSave;
2413
+ if (parentFileId === context.sceneConfigId) {
2414
+ filenameToSave = context.sceneSaveUrl;
2415
+ const strNodesToDelete = Array.from(nodesToDelete).map(String);
2416
+ const strLinksToDelete = Array.from(linksToDelete).map(String);
2417
+ sceneDataRef.current.nodes = sceneDataRef.current.nodes.filter((n) => !strNodesToDelete.includes(String(n.id)));
2418
+ sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => !strLinksToDelete.includes(String(l.id)));
2419
+ payloadToSave = {
2420
+ parent_dbs: sceneDataRef.current.parent_dbs,
2421
+ nodes: sceneDataRef.current.nodes,
2422
+ links: sceneDataRef.current.links,
2423
+ quest_nodes: originalData.nodes,
2424
+ quest_links: originalData.links
2425
+ };
2426
+ } else {
2427
+ filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
2428
+ payloadToSave = originalData;
2429
+ }
2430
+ savePromises.push(context.actions.save_view_data(filenameToSave, payloadToSave));
2396
2431
  updatedParentDataCache[parentFileId] = originalData;
2397
2432
  }
2398
2433
  }
@@ -2424,7 +2459,7 @@ var userActionHandlers = {
2424
2459
  if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
2425
2460
  const nodeIdToDelete = nodeData.id;
2426
2461
  const strNodeId = String(nodeIdToDelete);
2427
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete);
2462
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete, context.sceneConfigId, context.ownerId);
2428
2463
  if (!parentInfo || !parentInfo.ownerId) {
2429
2464
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser exclu\xEDdo:", nodeIdToDelete);
2430
2465
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para exclus\xE3o.");
@@ -2436,9 +2471,27 @@ var userActionHandlers = {
2436
2471
  const newLinks = (specificParentData.links || []).filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
2437
2472
  specificParentData.nodes = newNodes;
2438
2473
  specificParentData.links = newLinks;
2439
- const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2474
+ let filenameToSave;
2475
+ let payloadToSave;
2476
+ if (parentFileId === context.sceneConfigId) {
2477
+ filenameToSave = context.sceneSaveUrl;
2478
+ const newVisualNodes = sceneDataRef.current.nodes.filter((n) => String(n.id) !== strNodeId);
2479
+ const newVisualLinks = sceneDataRef.current.links.filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
2480
+ sceneDataRef.current.nodes = newVisualNodes;
2481
+ sceneDataRef.current.links = newVisualLinks;
2482
+ payloadToSave = {
2483
+ parent_dbs: sceneDataRef.current.parent_dbs,
2484
+ nodes: newVisualNodes,
2485
+ links: newVisualLinks,
2486
+ quest_nodes: specificParentData.nodes,
2487
+ quest_links: specificParentData.links
2488
+ };
2489
+ } else {
2490
+ filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
2491
+ payloadToSave = specificParentData;
2492
+ }
2440
2493
  try {
2441
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
2494
+ await context.actions.save_view_data(filenameToSave, payloadToSave);
2442
2495
  graphDataRef.current[parentFileId] = specificParentData;
2443
2496
  setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev);
2444
2497
  removeNodeFromScene(stateRef.current, nodeIdToDelete);
@@ -2452,7 +2505,7 @@ var userActionHandlers = {
2452
2505
  const { graphDataRef, sceneDataRef, stateRef, setters } = context;
2453
2506
  if (!graphDataRef.current || !sceneDataRef.current) return;
2454
2507
  const { _baseEmissiveIntensity: ignored, ...nodeToSave } = updatedNode;
2455
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id);
2508
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id, context.sceneConfigId, context.ownerId);
2456
2509
  if (!parentInfo || !parentInfo.ownerId) {
2457
2510
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser atualizado:", nodeToSave.id);
2458
2511
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
@@ -2486,7 +2539,7 @@ var userActionHandlers = {
2486
2539
  const { graphDataRef, sceneDataRef, stateRef, setters } = context;
2487
2540
  if (!graphDataRef.current || !sceneDataRef.current) return;
2488
2541
  const { sourceNode, targetNode, ...linkToSave } = updatedLink;
2489
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source);
2542
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source, context.sceneConfigId, context.ownerId);
2490
2543
  if (!parentInfo || !parentInfo.ownerId) {
2491
2544
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link a ser atualizado:", linkToSave.id);
2492
2545
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
@@ -7980,7 +8033,6 @@ function InSceneQuestForm({
7980
8033
  if (typeInput.trim()) handleAddType(typeInput);
7981
8034
  },
7982
8035
  className: "flex-1 bg-transparent text-sm min-w-[80px] focus:outline-none text-slate-200",
7983
- placeholder: "Ex.: Bugfix",
7984
8036
  autoComplete: "off"
7985
8037
  }
7986
8038
  ))), /* @__PURE__ */ import_react16.default.createElement("div", { className: "space-y-1.5 relative" }, /* @__PURE__ */ import_react16.default.createElement("label", { className: "text-xs text-slate-300" }, "Descri\xE7\xE3o (Opcional)"), /* @__PURE__ */ import_react16.default.createElement("div", { className: "relative group min-h-[80px] bg-slate-800/70 p-2.5 rounded-lg border border-white/10 hover:border-white/20 transition-colors" }, /* @__PURE__ */ import_react16.default.createElement(
@@ -11536,6 +11588,7 @@ function XViewScene({
11536
11588
  const newNode = {
11537
11589
  id: import_short_uuid2.default.generate(),
11538
11590
  ...newQuestData,
11591
+ is_quest: true,
11539
11592
  type: ["quest", ...newQuestData.type.filter((t) => t !== "quest")]
11540
11593
  };
11541
11594
  if (!graphDataRef.current[sceneConfigId2]) {
@@ -11585,8 +11638,8 @@ function XViewScene({
11585
11638
  userActionHandlers.handleCancelConnection(context);
11586
11639
  return;
11587
11640
  }
11588
- const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id);
11589
- const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id);
11641
+ const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id, sceneConfigId2, ownerId);
11642
+ const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id, sceneConfigId2, ownerId);
11590
11643
  let parentInfoToSave = sourceParentInfo;
11591
11644
  if (sourceParentInfo.parentFileId === sceneConfigId2 && targetParentInfo.parentFileId !== sceneConfigId2) {
11592
11645
  parentInfoToSave = targetParentInfo;
package/dist/index.mjs CHANGED
@@ -1515,7 +1515,7 @@ var addStandaloneNodeToScene = (state, nodeData, position) => {
1515
1515
  scaleTween.start();
1516
1516
  }
1517
1517
  };
1518
- var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
1518
+ var getParentFileInfoForNode = (allParentData, sceneData, nodeId, sceneConfigId = null, sceneOwnerId = null) => {
1519
1519
  const parentDbsArray = (sceneData == null ? void 0 : sceneData.parent_dbs) || [];
1520
1520
  for (const parentFileId in allParentData) {
1521
1521
  if (allParentData.hasOwnProperty(parentFileId)) {
@@ -1524,6 +1524,8 @@ var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
1524
1524
  const parentDbInfo = parentDbsArray.find((db) => String(db.db_id) === String(parentFileId));
1525
1525
  if (parentDbInfo) {
1526
1526
  return { parentFileId, ownerId: parentDbInfo.owner_id };
1527
+ } else if (sceneConfigId && String(parentFileId) === String(sceneConfigId)) {
1528
+ return { parentFileId, ownerId: sceneOwnerId };
1527
1529
  } else {
1528
1530
  console.warn(`Owner ID n\xE3o encontrado em sceneData.parent_dbs para o parentFileId: ${parentFileId}`);
1529
1531
  return { parentFileId, ownerId: null };
@@ -1802,7 +1804,7 @@ var userActionHandlers = {
1802
1804
  version_node: { is_version: true, parent_node: sourceNodeData.id }
1803
1805
  };
1804
1806
  const newLink = { id: `link_${short.generate()}`, source: sourceNodeData.id, target: newNode.id };
1805
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
1807
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
1806
1808
  if (!parentInfo || !parentInfo.ownerId) {
1807
1809
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
1808
1810
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
@@ -1978,7 +1980,7 @@ var userActionHandlers = {
1978
1980
  userActionHandlers.handleCancelConnection(context);
1979
1981
  return;
1980
1982
  }
1981
- const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
1983
+ const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
1982
1984
  if (!sourceParentInfo || !sourceParentInfo.ownerId) {
1983
1985
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
1984
1986
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
@@ -2067,8 +2069,8 @@ var userActionHandlers = {
2067
2069
  } else {
2068
2070
  newTargetId = newEndNodeData.id;
2069
2071
  }
2070
- const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId);
2071
- const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId);
2072
+ const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId, context.sceneConfigId, context.ownerId);
2073
+ const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId, context.sceneConfigId, context.ownerId);
2072
2074
  if (!originalParentInfo || !newParentInfo || !originalParentInfo.ownerId || !newParentInfo.ownerId) {
2073
2075
  console.error("N\xE3o foi poss\xEDvel encontrar informa\xE7\xF5es dos arquivos pai para o relink.");
2074
2076
  alert("Ocorreu um erro ao identificar os arquivos pai para salvar a altera\xE7\xE3o.");
@@ -2136,7 +2138,7 @@ var userActionHandlers = {
2136
2138
  console.error("Tentativa de deletar um link sem ID.", linkObject.userData);
2137
2139
  return;
2138
2140
  }
2139
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source);
2141
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source, context.sceneConfigId, context.ownerId);
2140
2142
  if (!parentInfo || !parentInfo.ownerId) {
2141
2143
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:", linkIdToDelete);
2142
2144
  alert("Ocorreu um erro ao identificar o arquivo pai da rela\xE7\xE3o para exclus\xE3o.");
@@ -2148,9 +2150,24 @@ var userActionHandlers = {
2148
2150
  const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
2149
2151
  const newLinks = (specificParentData.links || []).filter((l) => String(l.id) !== String(linkIdToDelete));
2150
2152
  specificParentData.links = newLinks;
2151
- const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2153
+ let filenameToSave;
2154
+ let payloadToSave;
2155
+ if (parentFileId === context.sceneConfigId) {
2156
+ filenameToSave = context.sceneSaveUrl;
2157
+ sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => String(l.id) !== String(linkIdToDelete));
2158
+ payloadToSave = {
2159
+ parent_dbs: sceneDataRef.current.parent_dbs,
2160
+ nodes: sceneDataRef.current.nodes,
2161
+ links: sceneDataRef.current.links,
2162
+ quest_nodes: specificParentData.nodes,
2163
+ quest_links: specificParentData.links
2164
+ };
2165
+ } else {
2166
+ filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
2167
+ payloadToSave = specificParentData;
2168
+ }
2152
2169
  try {
2153
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
2170
+ await context.actions.save_view_data(filenameToSave, payloadToSave);
2154
2171
  graphDataRef.current[parentFileId] = specificParentData;
2155
2172
  setters.setDetailsLink((prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev);
2156
2173
  if (stateRef.current.hoveredLink === linkObject) {
@@ -2313,7 +2330,7 @@ var userActionHandlers = {
2313
2330
  }
2314
2331
  const changesByParentFile = {};
2315
2332
  for (const nodeId of strNodeIdsToDelete) {
2316
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId);
2333
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId, context.sceneConfigId, context.ownerId);
2317
2334
  if (!parentInfo || !parentInfo.ownerId) {
2318
2335
  console.warn(`Node com ID ${nodeId} n\xE3o encontrado ou sem ownerId. Ignorando.`);
2319
2336
  continue;
@@ -2347,8 +2364,26 @@ var userActionHandlers = {
2347
2364
  originalData.links = (originalData.links || []).filter(
2348
2365
  (l) => !linksToDelete.has(String(l.id))
2349
2366
  );
2350
- const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2351
- savePromises.push(context.actions.save_view_data(filenameForSpecificParent, originalData));
2367
+ let filenameToSave;
2368
+ let payloadToSave;
2369
+ if (parentFileId === context.sceneConfigId) {
2370
+ filenameToSave = context.sceneSaveUrl;
2371
+ const strNodesToDelete = Array.from(nodesToDelete).map(String);
2372
+ const strLinksToDelete = Array.from(linksToDelete).map(String);
2373
+ sceneDataRef.current.nodes = sceneDataRef.current.nodes.filter((n) => !strNodesToDelete.includes(String(n.id)));
2374
+ sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => !strLinksToDelete.includes(String(l.id)));
2375
+ payloadToSave = {
2376
+ parent_dbs: sceneDataRef.current.parent_dbs,
2377
+ nodes: sceneDataRef.current.nodes,
2378
+ links: sceneDataRef.current.links,
2379
+ quest_nodes: originalData.nodes,
2380
+ quest_links: originalData.links
2381
+ };
2382
+ } else {
2383
+ filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
2384
+ payloadToSave = originalData;
2385
+ }
2386
+ savePromises.push(context.actions.save_view_data(filenameToSave, payloadToSave));
2352
2387
  updatedParentDataCache[parentFileId] = originalData;
2353
2388
  }
2354
2389
  }
@@ -2380,7 +2415,7 @@ var userActionHandlers = {
2380
2415
  if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
2381
2416
  const nodeIdToDelete = nodeData.id;
2382
2417
  const strNodeId = String(nodeIdToDelete);
2383
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete);
2418
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete, context.sceneConfigId, context.ownerId);
2384
2419
  if (!parentInfo || !parentInfo.ownerId) {
2385
2420
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser exclu\xEDdo:", nodeIdToDelete);
2386
2421
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para exclus\xE3o.");
@@ -2392,9 +2427,27 @@ var userActionHandlers = {
2392
2427
  const newLinks = (specificParentData.links || []).filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
2393
2428
  specificParentData.nodes = newNodes;
2394
2429
  specificParentData.links = newLinks;
2395
- const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2430
+ let filenameToSave;
2431
+ let payloadToSave;
2432
+ if (parentFileId === context.sceneConfigId) {
2433
+ filenameToSave = context.sceneSaveUrl;
2434
+ const newVisualNodes = sceneDataRef.current.nodes.filter((n) => String(n.id) !== strNodeId);
2435
+ const newVisualLinks = sceneDataRef.current.links.filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
2436
+ sceneDataRef.current.nodes = newVisualNodes;
2437
+ sceneDataRef.current.links = newVisualLinks;
2438
+ payloadToSave = {
2439
+ parent_dbs: sceneDataRef.current.parent_dbs,
2440
+ nodes: newVisualNodes,
2441
+ links: newVisualLinks,
2442
+ quest_nodes: specificParentData.nodes,
2443
+ quest_links: specificParentData.links
2444
+ };
2445
+ } else {
2446
+ filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
2447
+ payloadToSave = specificParentData;
2448
+ }
2396
2449
  try {
2397
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
2450
+ await context.actions.save_view_data(filenameToSave, payloadToSave);
2398
2451
  graphDataRef.current[parentFileId] = specificParentData;
2399
2452
  setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev);
2400
2453
  removeNodeFromScene(stateRef.current, nodeIdToDelete);
@@ -2408,7 +2461,7 @@ var userActionHandlers = {
2408
2461
  const { graphDataRef, sceneDataRef, stateRef, setters } = context;
2409
2462
  if (!graphDataRef.current || !sceneDataRef.current) return;
2410
2463
  const { _baseEmissiveIntensity: ignored, ...nodeToSave } = updatedNode;
2411
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id);
2464
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id, context.sceneConfigId, context.ownerId);
2412
2465
  if (!parentInfo || !parentInfo.ownerId) {
2413
2466
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser atualizado:", nodeToSave.id);
2414
2467
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
@@ -2442,7 +2495,7 @@ var userActionHandlers = {
2442
2495
  const { graphDataRef, sceneDataRef, stateRef, setters } = context;
2443
2496
  if (!graphDataRef.current || !sceneDataRef.current) return;
2444
2497
  const { sourceNode, targetNode, ...linkToSave } = updatedLink;
2445
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source);
2498
+ const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source, context.sceneConfigId, context.ownerId);
2446
2499
  if (!parentInfo || !parentInfo.ownerId) {
2447
2500
  console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link a ser atualizado:", linkToSave.id);
2448
2501
  alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
@@ -7967,7 +8020,6 @@ function InSceneQuestForm({
7967
8020
  if (typeInput.trim()) handleAddType(typeInput);
7968
8021
  },
7969
8022
  className: "flex-1 bg-transparent text-sm min-w-[80px] focus:outline-none text-slate-200",
7970
- placeholder: "Ex.: Bugfix",
7971
8023
  autoComplete: "off"
7972
8024
  }
7973
8025
  ))), /* @__PURE__ */ React15.createElement("div", { className: "space-y-1.5 relative" }, /* @__PURE__ */ React15.createElement("label", { className: "text-xs text-slate-300" }, "Descri\xE7\xE3o (Opcional)"), /* @__PURE__ */ React15.createElement("div", { className: "relative group min-h-[80px] bg-slate-800/70 p-2.5 rounded-lg border border-white/10 hover:border-white/20 transition-colors" }, /* @__PURE__ */ React15.createElement(
@@ -11536,6 +11588,7 @@ function XViewScene({
11536
11588
  const newNode = {
11537
11589
  id: short2.generate(),
11538
11590
  ...newQuestData,
11591
+ is_quest: true,
11539
11592
  type: ["quest", ...newQuestData.type.filter((t) => t !== "quest")]
11540
11593
  };
11541
11594
  if (!graphDataRef.current[sceneConfigId2]) {
@@ -11585,8 +11638,8 @@ function XViewScene({
11585
11638
  userActionHandlers.handleCancelConnection(context);
11586
11639
  return;
11587
11640
  }
11588
- const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id);
11589
- const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id);
11641
+ const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id, sceneConfigId2, ownerId);
11642
+ const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id, sceneConfigId2, ownerId);
11590
11643
  let parentInfoToSave = sourceParentInfo;
11591
11644
  if (sourceParentInfo.parentFileId === sceneConfigId2 && targetParentInfo.parentFileId !== sceneConfigId2) {
11592
11645
  parentInfoToSave = targetParentInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.4-dev.6",
3
+ "version": "1.2.4-dev.8",
4
4
  "description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
5
5
  "author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
6
6
  "license": "UNLICENSED",