@lv-x-software-house/x_view 1.2.8-dev.11 → 1.2.8-dev.13

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
@@ -1530,10 +1530,16 @@ var userActionHandlers = {
1530
1530
  context.sceneConfigId,
1531
1531
  context.ownerId
1532
1532
  );
1533
- if (!sourceParentInfo || !sourceParentInfo.ownerId) {
1533
+ const targetParentInfo = getParentFileInfoForNode(
1534
+ graphDataRef.current,
1535
+ sceneDataRef.current,
1536
+ targetNodeData.id,
1537
+ context.sceneConfigId,
1538
+ context.ownerId
1539
+ );
1540
+ if (!sourceParentInfo || !sourceParentInfo.ownerId || !targetParentInfo) {
1534
1541
  console.error(
1535
- "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:",
1536
- sourceNodeData.id
1542
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para os Nodes da conex\xE3o."
1537
1543
  );
1538
1544
  alert(
1539
1545
  "Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio."
@@ -1541,9 +1547,13 @@ var userActionHandlers = {
1541
1547
  userActionHandlers.handleCancelConnection(context);
1542
1548
  return;
1543
1549
  }
1544
- const { parentFileId: sourceParentFileId, ownerId: sourceOwnerId } = sourceParentInfo;
1545
- const parentFileIdToSave = sourceParentFileId;
1546
- const ownerIdToSave = sourceOwnerId;
1550
+ let parentInfoToSave = sourceParentInfo;
1551
+ const isSourceQuest = sourceParentInfo.parentFileId === context.sceneConfigId;
1552
+ const isTargetQuest = targetParentInfo.parentFileId === context.sceneConfigId;
1553
+ if (isSourceQuest || isTargetQuest) {
1554
+ parentInfoToSave = { parentFileId: context.sceneConfigId, ownerId: context.ownerId };
1555
+ }
1556
+ const { parentFileId: parentFileIdToSave, ownerId: ownerIdToSave } = parentInfoToSave;
1547
1557
  const newLink = {
1548
1558
  id: `link_${import_short_uuid.default.generate()}`,
1549
1559
  source: sourceNodeData.id,
@@ -1834,14 +1844,21 @@ var userActionHandlers = {
1834
1844
  );
1835
1845
  return;
1836
1846
  }
1837
- const parentInfo = getParentFileInfoForNode(
1847
+ const sourceParentInfo = getParentFileInfoForNode(
1838
1848
  graphDataRef.current,
1839
1849
  sceneDataRef.current,
1840
1850
  linkObject.userData.source,
1841
1851
  context.sceneConfigId,
1842
1852
  context.ownerId
1843
1853
  );
1844
- if (!parentInfo || !parentInfo.ownerId) {
1854
+ const targetParentInfo = getParentFileInfoForNode(
1855
+ graphDataRef.current,
1856
+ sceneDataRef.current,
1857
+ linkObject.userData.target,
1858
+ context.sceneConfigId,
1859
+ context.ownerId
1860
+ );
1861
+ if (!sourceParentInfo || !sourceParentInfo.ownerId) {
1845
1862
  console.error(
1846
1863
  "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:",
1847
1864
  linkIdToDelete
@@ -1851,6 +1868,12 @@ var userActionHandlers = {
1851
1868
  );
1852
1869
  return;
1853
1870
  }
1871
+ let parentInfo = sourceParentInfo;
1872
+ const isSourceQuest = sourceParentInfo.parentFileId === context.sceneConfigId;
1873
+ const isTargetQuest = (targetParentInfo == null ? void 0 : targetParentInfo.parentFileId) === context.sceneConfigId;
1874
+ if (isSourceQuest || isTargetQuest) {
1875
+ parentInfo = { parentFileId: context.sceneConfigId, ownerId: context.ownerId };
1876
+ }
1854
1877
  const { parentFileId, ownerId } = parentInfo;
1855
1878
  const srcName = ((_c = (_b = (_a = linkObject.userData) == null ? void 0 : _a.sourceNode) == null ? void 0 : _b.userData) == null ? void 0 : _c.name) ?? linkObject.userData.source;
1856
1879
  const tgtName = ((_f = (_e = (_d = linkObject.userData) == null ? void 0 : _d.targetNode) == null ? void 0 : _e.userData) == null ? void 0 : _f.name) ?? linkObject.userData.target;
@@ -9005,6 +9028,7 @@ function CreateQuestTreePanel({
9005
9028
  const [isSaving, setIsSaving] = (0, import_react12.useState)(false);
9006
9029
  const [hasUnsavedChanges, setHasUnsavedChanges] = (0, import_react12.useState)(false);
9007
9030
  const [activeTab, setActiveTab] = (0, import_react12.useState)("tree");
9031
+ const isInitialLoad = (0, import_react12.useRef)(true);
9008
9032
  const maxPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
9009
9033
  const { width: panelWidth, isResizing, handlePointerDown: handleResize } = useResizablePanel({
9010
9034
  initialWidth: 440,
@@ -9038,10 +9062,11 @@ function CreateQuestTreePanel({
9038
9062
  const indexToRemove = pathToRemove[pathToRemove.length - 1];
9039
9063
  if (currentParent.children && currentParent.children.length > indexToRemove) {
9040
9064
  currentParent.children.splice(indexToRemove, 1);
9041
- setHasUnsavedChanges(true);
9065
+ return { ...prev, [treeKey]: newTree };
9042
9066
  }
9043
- return { ...prev, [treeKey]: newTree };
9067
+ return prev;
9044
9068
  });
9069
+ setHasUnsavedChanges(true);
9045
9070
  }, [setQuestTreeMode, activeTab]);
9046
9071
  const handleMoveNode = (sourceId, targetId) => {
9047
9072
  const isAbstraction = activeTab === "abstraction";
@@ -9118,6 +9143,15 @@ function CreateQuestTreePanel({
9118
9143
  }));
9119
9144
  }
9120
9145
  }, [tree, abstraction_tree, questTreeMode.questNodeId, setQuestTreeMode]);
9146
+ (0, import_react12.useEffect)(() => {
9147
+ if (tree || abstraction_tree) {
9148
+ if (isInitialLoad.current) {
9149
+ isInitialLoad.current = false;
9150
+ return;
9151
+ }
9152
+ setHasUnsavedChanges(true);
9153
+ }
9154
+ }, [tree, abstraction_tree]);
9121
9155
  return /* @__PURE__ */ import_react12.default.createElement(
9122
9156
  "div",
9123
9157
  {
@@ -18425,84 +18459,6 @@ function XViewScene({
18425
18459
  alert("Ocorreu um erro ao criar a Quest.");
18426
18460
  }
18427
18461
  };
18428
- userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
18429
- const {
18430
- stateRef: stateRef2,
18431
- graphDataRef: graphDataRef2,
18432
- sceneDataRef: sceneDataRef2,
18433
- sceneConfigId: sceneConfigId2,
18434
- sceneSaveUrl: sceneSaveUrl2,
18435
- ownerId: ownerId2
18436
- } = context;
18437
- const { sourceNodeData } = stateRef2.current.connection;
18438
- if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
18439
- userActionHandlers.handleCancelConnection(context);
18440
- return;
18441
- }
18442
- const sourceParentInfo = getParentFileInfoForNode(
18443
- graphDataRef2.current,
18444
- sceneDataRef2.current,
18445
- sourceNodeData.id,
18446
- sceneConfigId2,
18447
- ownerId2
18448
- );
18449
- const targetParentInfo = getParentFileInfoForNode(
18450
- graphDataRef2.current,
18451
- sceneDataRef2.current,
18452
- targetNodeData.id,
18453
- sceneConfigId2,
18454
- ownerId2
18455
- );
18456
- let parentInfoToSave = sourceParentInfo;
18457
- const isSourceQuest = sourceParentInfo.parentFileId === sceneConfigId2;
18458
- const isTargetQuest = targetParentInfo.parentFileId === sceneConfigId2;
18459
- if (isSourceQuest || isTargetQuest) {
18460
- parentInfoToSave = { parentFileId: sceneConfigId2, ownerId: ownerId2 };
18461
- }
18462
- const { parentFileId: parentFileIdToSave, ownerId: ownerIdToSave } = parentInfoToSave;
18463
- const newLink = {
18464
- id: `link_${import_short_uuid2.default.generate()}`,
18465
- source: sourceNodeData.id,
18466
- target: targetNodeData.id
18467
- };
18468
- try {
18469
- if (parentFileIdToSave === sceneConfigId2) {
18470
- const specificParentData = graphDataRef2.current[sceneConfigId2];
18471
- specificParentData.links.push(newLink);
18472
- const viewFilePayload = {
18473
- ...sceneDataRef2.current,
18474
- quest_counter: sceneDataRef2.current.quest_counter || 1
18475
- };
18476
- const questFilePayload = {
18477
- nodes: specificParentData.nodes,
18478
- links: specificParentData.links,
18479
- milestones: sceneDataRef2.current.milestones || []
18480
- };
18481
- await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
18482
- const questSaveUrl = sceneSaveUrl2.replace(
18483
- "x_view_scenes",
18484
- "x_view_quests"
18485
- );
18486
- await context.actions.save_view_data(questSaveUrl, questFilePayload);
18487
- } else {
18488
- const specificParentData = JSON.parse(
18489
- JSON.stringify(graphDataRef2.current[parentFileIdToSave])
18490
- );
18491
- specificParentData.links.push(newLink);
18492
- const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
18493
- await context.actions.save_view_data(
18494
- filenameForSpecificParent,
18495
- specificParentData
18496
- );
18497
- graphDataRef2.current[parentFileIdToSave] = specificParentData;
18498
- }
18499
- addNewLinkToScene(stateRef2.current, newLink);
18500
- } catch (error) {
18501
- console.error("Falha ao salvar a nova conex\xE3o:", error);
18502
- alert("Ocorreu um erro ao salvar a nova conex\xE3o.");
18503
- }
18504
- userActionHandlers.handleCancelConnection(context);
18505
- };
18506
18462
  const handleClearAncestryVisuals = (0, import_react33.useCallback)((ancestryId) => {
18507
18463
  const { renderedAncestries, ancestryGroup } = stateRef.current;
18508
18464
  const renderIndex = renderedAncestries.findIndex(
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import React32, {
3
3
  useCallback as useCallback7,
4
4
  useEffect as useEffect25,
5
- useRef as useRef21,
5
+ useRef as useRef22,
6
6
  useState as useState30,
7
7
  useMemo as useMemo14
8
8
  } from "react";
@@ -1491,10 +1491,16 @@ var userActionHandlers = {
1491
1491
  context.sceneConfigId,
1492
1492
  context.ownerId
1493
1493
  );
1494
- if (!sourceParentInfo || !sourceParentInfo.ownerId) {
1494
+ const targetParentInfo = getParentFileInfoForNode(
1495
+ graphDataRef.current,
1496
+ sceneDataRef.current,
1497
+ targetNodeData.id,
1498
+ context.sceneConfigId,
1499
+ context.ownerId
1500
+ );
1501
+ if (!sourceParentInfo || !sourceParentInfo.ownerId || !targetParentInfo) {
1495
1502
  console.error(
1496
- "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:",
1497
- sourceNodeData.id
1503
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para os Nodes da conex\xE3o."
1498
1504
  );
1499
1505
  alert(
1500
1506
  "Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio."
@@ -1502,9 +1508,13 @@ var userActionHandlers = {
1502
1508
  userActionHandlers.handleCancelConnection(context);
1503
1509
  return;
1504
1510
  }
1505
- const { parentFileId: sourceParentFileId, ownerId: sourceOwnerId } = sourceParentInfo;
1506
- const parentFileIdToSave = sourceParentFileId;
1507
- const ownerIdToSave = sourceOwnerId;
1511
+ let parentInfoToSave = sourceParentInfo;
1512
+ const isSourceQuest = sourceParentInfo.parentFileId === context.sceneConfigId;
1513
+ const isTargetQuest = targetParentInfo.parentFileId === context.sceneConfigId;
1514
+ if (isSourceQuest || isTargetQuest) {
1515
+ parentInfoToSave = { parentFileId: context.sceneConfigId, ownerId: context.ownerId };
1516
+ }
1517
+ const { parentFileId: parentFileIdToSave, ownerId: ownerIdToSave } = parentInfoToSave;
1508
1518
  const newLink = {
1509
1519
  id: `link_${short.generate()}`,
1510
1520
  source: sourceNodeData.id,
@@ -1795,14 +1805,21 @@ var userActionHandlers = {
1795
1805
  );
1796
1806
  return;
1797
1807
  }
1798
- const parentInfo = getParentFileInfoForNode(
1808
+ const sourceParentInfo = getParentFileInfoForNode(
1799
1809
  graphDataRef.current,
1800
1810
  sceneDataRef.current,
1801
1811
  linkObject.userData.source,
1802
1812
  context.sceneConfigId,
1803
1813
  context.ownerId
1804
1814
  );
1805
- if (!parentInfo || !parentInfo.ownerId) {
1815
+ const targetParentInfo = getParentFileInfoForNode(
1816
+ graphDataRef.current,
1817
+ sceneDataRef.current,
1818
+ linkObject.userData.target,
1819
+ context.sceneConfigId,
1820
+ context.ownerId
1821
+ );
1822
+ if (!sourceParentInfo || !sourceParentInfo.ownerId) {
1806
1823
  console.error(
1807
1824
  "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:",
1808
1825
  linkIdToDelete
@@ -1812,6 +1829,12 @@ var userActionHandlers = {
1812
1829
  );
1813
1830
  return;
1814
1831
  }
1832
+ let parentInfo = sourceParentInfo;
1833
+ const isSourceQuest = sourceParentInfo.parentFileId === context.sceneConfigId;
1834
+ const isTargetQuest = (targetParentInfo == null ? void 0 : targetParentInfo.parentFileId) === context.sceneConfigId;
1835
+ if (isSourceQuest || isTargetQuest) {
1836
+ parentInfo = { parentFileId: context.sceneConfigId, ownerId: context.ownerId };
1837
+ }
1815
1838
  const { parentFileId, ownerId } = parentInfo;
1816
1839
  const srcName = ((_c = (_b = (_a = linkObject.userData) == null ? void 0 : _a.sourceNode) == null ? void 0 : _b.userData) == null ? void 0 : _c.name) ?? linkObject.userData.source;
1817
1840
  const tgtName = ((_f = (_e = (_d = linkObject.userData) == null ? void 0 : _d.targetNode) == null ? void 0 : _e.userData) == null ? void 0 : _f.name) ?? linkObject.userData.target;
@@ -8886,7 +8909,7 @@ function CreateAncestryPanel({
8886
8909
  }
8887
8910
 
8888
8911
  // src/components/CreateQuestTreePanel.jsx
8889
- import React11, { useState as useState12, useEffect as useEffect11, useCallback as useCallback3, useMemo as useMemo9 } from "react";
8912
+ import React11, { useState as useState12, useEffect as useEffect11, useCallback as useCallback3, useMemo as useMemo9, useRef as useRef9 } from "react";
8890
8913
  import {
8891
8914
  FiFolder as FiFolder3,
8892
8915
  FiLayers as FiLayers6,
@@ -9003,6 +9026,7 @@ function CreateQuestTreePanel({
9003
9026
  const [isSaving, setIsSaving] = useState12(false);
9004
9027
  const [hasUnsavedChanges, setHasUnsavedChanges] = useState12(false);
9005
9028
  const [activeTab, setActiveTab] = useState12("tree");
9029
+ const isInitialLoad = useRef9(true);
9006
9030
  const maxPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
9007
9031
  const { width: panelWidth, isResizing, handlePointerDown: handleResize } = useResizablePanel({
9008
9032
  initialWidth: 440,
@@ -9036,10 +9060,11 @@ function CreateQuestTreePanel({
9036
9060
  const indexToRemove = pathToRemove[pathToRemove.length - 1];
9037
9061
  if (currentParent.children && currentParent.children.length > indexToRemove) {
9038
9062
  currentParent.children.splice(indexToRemove, 1);
9039
- setHasUnsavedChanges(true);
9063
+ return { ...prev, [treeKey]: newTree };
9040
9064
  }
9041
- return { ...prev, [treeKey]: newTree };
9065
+ return prev;
9042
9066
  });
9067
+ setHasUnsavedChanges(true);
9043
9068
  }, [setQuestTreeMode, activeTab]);
9044
9069
  const handleMoveNode = (sourceId, targetId) => {
9045
9070
  const isAbstraction = activeTab === "abstraction";
@@ -9116,6 +9141,15 @@ function CreateQuestTreePanel({
9116
9141
  }));
9117
9142
  }
9118
9143
  }, [tree, abstraction_tree, questTreeMode.questNodeId, setQuestTreeMode]);
9144
+ useEffect11(() => {
9145
+ if (tree || abstraction_tree) {
9146
+ if (isInitialLoad.current) {
9147
+ isInitialLoad.current = false;
9148
+ return;
9149
+ }
9150
+ setHasUnsavedChanges(true);
9151
+ }
9152
+ }, [tree, abstraction_tree]);
9119
9153
  return /* @__PURE__ */ React11.createElement(
9120
9154
  "div",
9121
9155
  {
@@ -9306,11 +9340,11 @@ function ImageViewer({ data, onClose }) {
9306
9340
  }
9307
9341
 
9308
9342
  // src/components/InSceneCreationForm.jsx
9309
- import React15, { useState as useState15, useEffect as useEffect14, useRef as useRef10 } from "react";
9343
+ import React15, { useState as useState15, useEffect as useEffect14, useRef as useRef11 } from "react";
9310
9344
  import { v4 as uuidv45 } from "uuid";
9311
9345
 
9312
9346
  // src/components/ColorPicker.jsx
9313
- import React13, { useState as useState14, useEffect as useEffect13, useRef as useRef9 } from "react";
9347
+ import React13, { useState as useState14, useEffect as useEffect13, useRef as useRef10 } from "react";
9314
9348
  import { HexColorPicker } from "react-colorful";
9315
9349
  import { FiHash, FiCheck as FiCheck6 } from "react-icons/fi";
9316
9350
  var PRESET_COLORS = [
@@ -9332,7 +9366,7 @@ var PRESET_COLORS = [
9332
9366
  ];
9333
9367
  function ColorPicker({ color, onChange, disabled, isCompact = false }) {
9334
9368
  const [isOpen, setIsOpen] = useState14(false);
9335
- const popoverRef = useRef9(null);
9369
+ const popoverRef = useRef10(null);
9336
9370
  useEffect13(() => {
9337
9371
  const handleClickOutside = (event) => {
9338
9372
  if (popoverRef.current && !popoverRef.current.contains(event.target)) {
@@ -9559,7 +9593,7 @@ function InSceneCreationForm({
9559
9593
  const [isDatasetDropdownOpen, setIsDatasetDropdownOpen] = useState15(false);
9560
9594
  const [isLoadingDocs, setIsLoadingDocs] = useState15(false);
9561
9595
  const [docError, setDocError] = useState15(null);
9562
- const datasetDropdownRef = useRef10(null);
9596
+ const datasetDropdownRef = useRef11(null);
9563
9597
  useEffect14(() => {
9564
9598
  if (sourceNodeDatasetId) setTargetDatasetId(sourceNodeDatasetId);
9565
9599
  }, [sourceNodeDatasetId]);
@@ -9576,7 +9610,7 @@ function InSceneCreationForm({
9576
9610
  document.removeEventListener("mousedown", handleClickOutside);
9577
9611
  };
9578
9612
  }, [isDatasetDropdownOpen]);
9579
- const propsEndRef = useRef10(null);
9613
+ const propsEndRef = useRef11(null);
9580
9614
  const hasImages = customProps.some(
9581
9615
  (p) => p.type === "images" && Array.isArray(p.value) && p.value.length > 0 && p.value.some((img) => img.value)
9582
9616
  );
@@ -10079,7 +10113,7 @@ function InSceneCreationForm({
10079
10113
  }
10080
10114
 
10081
10115
  // src/components/InSceneVersionForm.jsx
10082
- import React16, { useState as useState16, useEffect as useEffect15, useRef as useRef11 } from "react";
10116
+ import React16, { useState as useState16, useEffect as useEffect15, useRef as useRef12 } from "react";
10083
10117
  import { v4 as uuidv46 } from "uuid";
10084
10118
  import { FiPlus as FiPlus5, FiMaximize2 as FiMaximize22, FiCheck as FiCheck8, FiEdit2 as FiEdit25 } from "react-icons/fi";
10085
10119
  function InSceneVersionForm({
@@ -10111,7 +10145,7 @@ function InSceneVersionForm({
10111
10145
  }
10112
10146
  ]);
10113
10147
  const [isDescriptionModalOpen, setIsDescriptionModalOpen] = useState16(false);
10114
- const propsEndRef = useRef11(null);
10148
+ const propsEndRef = useRef12(null);
10115
10149
  const [useImageAsTexture, setUseImageAsTexture] = useState16(false);
10116
10150
  const [selectedImageUrl, setSelectedImageUrl] = useState16(null);
10117
10151
  const hasImages = customProps.some(
@@ -10395,7 +10429,7 @@ function InSceneVersionForm({
10395
10429
  }
10396
10430
 
10397
10431
  // src/components/InSceneQuestForm.jsx
10398
- import React18, { useState as useState18, useRef as useRef12 } from "react";
10432
+ import React18, { useState as useState18, useRef as useRef13 } from "react";
10399
10433
  import { v4 as uuidv47 } from "uuid";
10400
10434
  import {
10401
10435
  FiPlus as FiPlus7,
@@ -10634,7 +10668,7 @@ function InSceneQuestForm({
10634
10668
  const [docError, setDocError] = useState18(null);
10635
10669
  const [customProps, setCustomProps] = useState18([]);
10636
10670
  const [isDescriptionModalOpen, setIsDescriptionModalOpen] = useState18(false);
10637
- const propsEndRef = useRef12(null);
10671
+ const propsEndRef = useRef13(null);
10638
10672
  const [milestoneInput, setMilestoneInput] = useState18("");
10639
10673
  const [showMilestoneSuggestions, setShowMilestoneSuggestions] = useState18(false);
10640
10674
  const activeMilestones = React18.useMemo(
@@ -11429,7 +11463,7 @@ function InSceneQuestForm({
11429
11463
  }
11430
11464
 
11431
11465
  // src/components/NodeDetailsPanel.jsx
11432
- import React19, { useState as useState19, useEffect as useEffect16, useRef as useRef13 } from "react";
11466
+ import React19, { useState as useState19, useEffect as useEffect16, useRef as useRef14 } from "react";
11433
11467
  import { v4 as uuidv48 } from "uuid";
11434
11468
  import { FiPlus as FiPlus8, FiMaximize2 as FiMaximize23, FiX as FiX6, FiCheck as FiCheck10, FiImage as FiImage3, FiEdit2 as FiEdit27, FiLoader as FiLoader2, FiBookOpen as FiBookOpen3, FiSun as FiSun2, FiLink as FiLink5, FiDatabase } from "react-icons/fi";
11435
11469
  import { AiOutlineLoading3Quarters as AiOutlineLoading3Quarters3 } from "react-icons/ai";
@@ -11489,8 +11523,8 @@ function NodeDetailsPanel({
11489
11523
  useEffect16(() => {
11490
11524
  setWidth(isReadMode ? 700 : 440);
11491
11525
  }, [isReadMode, setWidth]);
11492
- const prevNodeIdRef = useRef13(null);
11493
- const propsEndRef = useRef13(null);
11526
+ const prevNodeIdRef = useRef14(null);
11527
+ const propsEndRef = useRef14(null);
11494
11528
  const canEdit = userRole !== "viewer";
11495
11529
  const availableImages = customProps.filter((p) => p.type === "images").flatMap((p) => Array.isArray(p.value) ? p.value : []).filter((img) => img.value && img.value.trim() !== "");
11496
11530
  const handleImageClickFromText = (url, name2) => {
@@ -12055,7 +12089,7 @@ function NodeDetailsPanel({
12055
12089
  }
12056
12090
 
12057
12091
  // src/components/QuestDetailsPanel.jsx
12058
- import React21, { useState as useState20, useEffect as useEffect17, useRef as useRef14 } from "react";
12092
+ import React21, { useState as useState20, useEffect as useEffect17, useRef as useRef15 } from "react";
12059
12093
  import { v4 as uuidv49 } from "uuid";
12060
12094
  import { FiPlus as FiPlus9, FiX as FiX7, FiCheck as FiCheck11, FiEdit2 as FiEdit28, FiLoader as FiLoader3, FiBookOpen as FiBookOpen4, FiLink as FiLink7, FiTarget as FiTarget3, FiChevronDown as FiChevronDown7, FiUser as FiUser3, FiSearch as FiSearch7, FiRepeat as FiRepeat2, FiCalendar as FiCalendar2, FiImage as FiImage4, FiCopy as FiCopy4, FiGitBranch as FiGitBranch4 } from "react-icons/fi";
12061
12095
 
@@ -12323,8 +12357,8 @@ function QuestDetailsPanel({
12323
12357
  useEffect17(() => {
12324
12358
  setWidth(isReadMode ? 700 : 440);
12325
12359
  }, [isReadMode, setWidth]);
12326
- const prevNodeIdRef = useRef14(null);
12327
- const propsEndRef = useRef14(null);
12360
+ const prevNodeIdRef = useRef15(null);
12361
+ const propsEndRef = useRef15(null);
12328
12362
  const canEdit = userRole !== "viewer";
12329
12363
  const availableImages = customProps.filter((p) => p.type === "images").flatMap((p) => Array.isArray(p.value) ? p.value : []).filter((img) => img.value && img.value.trim() !== "");
12330
12364
  const handleImageClickFromText = (url, name) => {
@@ -13475,7 +13509,7 @@ ${noteText}` : noteText : entry.notes,
13475
13509
  }
13476
13510
 
13477
13511
  // src/components/MultiNodeContextMenu.jsx
13478
- import React22, { useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as useState21, useEffect as useEffect18 } from "react";
13512
+ import React22, { useLayoutEffect as useLayoutEffect3, useRef as useRef16, useState as useState21, useEffect as useEffect18 } from "react";
13479
13513
  function MultiNodeContextMenu({
13480
13514
  data,
13481
13515
  userRole,
@@ -13484,7 +13518,7 @@ function MultiNodeContextMenu({
13484
13518
  onDismissOtherNodes,
13485
13519
  onDeleteNodes
13486
13520
  }) {
13487
- const menuRef = useRef15(null);
13521
+ const menuRef = useRef16(null);
13488
13522
  const [menuPos, setMenuPos] = useState21({ left: 0, top: 0 });
13489
13523
  const [isConfirmingDelete, setIsConfirmingDelete] = useState21(false);
13490
13524
  const ability = defineAbilityFor(userRole);
@@ -13551,7 +13585,7 @@ function MultiNodeContextMenu({
13551
13585
  }
13552
13586
 
13553
13587
  // src/components/RelationshipDetailsPanel.jsx
13554
- import React23, { useState as useState22, useEffect as useEffect19, useRef as useRef16, useMemo as useMemo10 } from "react";
13588
+ import React23, { useState as useState22, useEffect as useEffect19, useRef as useRef17, useMemo as useMemo10 } from "react";
13555
13589
  import { v4 as uuidv410 } from "uuid";
13556
13590
  import { FiPlus as FiPlus10, FiEdit2 as FiEdit29, FiLoader as FiLoader4, FiBookOpen as FiBookOpen5 } from "react-icons/fi";
13557
13591
  function RelationshipDetailsPanel({
@@ -13582,7 +13616,7 @@ function RelationshipDetailsPanel({
13582
13616
  const [isSaving, setIsSaving] = useState22(false);
13583
13617
  const [isReadMode, setIsReadMode] = useState22(false);
13584
13618
  const [hasUnsavedChanges, setHasUnsavedChanges] = useState22(false);
13585
- const propsEndRef = useRef16(null);
13619
+ const propsEndRef = useRef17(null);
13586
13620
  const canEdit = useMemo10(() => {
13587
13621
  const ability = defineAbilityFor(userRole);
13588
13622
  return ability.can("update", "Connection");
@@ -13903,7 +13937,7 @@ function RelationshipDetailsPanel({
13903
13937
  }
13904
13938
 
13905
13939
  // src/components/RelationshipContextMenu.jsx
13906
- import React24, { useLayoutEffect as useLayoutEffect4, useRef as useRef17, useState as useState23, useEffect as useEffect20, useMemo as useMemo11 } from "react";
13940
+ import React24, { useLayoutEffect as useLayoutEffect4, useRef as useRef18, useState as useState23, useEffect as useEffect20, useMemo as useMemo11 } from "react";
13907
13941
  function RelationshipContextMenu({
13908
13942
  data,
13909
13943
  userRole,
@@ -13913,7 +13947,7 @@ function RelationshipContextMenu({
13913
13947
  onDelete,
13914
13948
  onClose
13915
13949
  }) {
13916
- const menuRef = useRef17(null);
13950
+ const menuRef = useRef18(null);
13917
13951
  const [menuPos, setMenuPos] = useState23({ left: 0, top: 0 });
13918
13952
  const [isConfirmingDelete, setIsConfirmingDelete] = useState23(false);
13919
13953
  const ability = useMemo11(() => defineAbilityFor(userRole), [userRole]);
@@ -14395,7 +14429,7 @@ import React30, {
14395
14429
  useState as useState28,
14396
14430
  useMemo as useMemo13,
14397
14431
  useEffect as useEffect24,
14398
- useRef as useRef20,
14432
+ useRef as useRef21,
14399
14433
  useCallback as useCallback6
14400
14434
  } from "react";
14401
14435
  import {
@@ -14421,10 +14455,10 @@ import {
14421
14455
  import { v4 as uuidv411 } from "uuid";
14422
14456
 
14423
14457
  // src/components/RichGroupEditor.jsx
14424
- import React29, { useEffect as useEffect23, useRef as useRef19, useState as useState27, useCallback as useCallback5 } from "react";
14458
+ import React29, { useEffect as useEffect23, useRef as useRef20, useState as useState27, useCallback as useCallback5 } from "react";
14425
14459
 
14426
14460
  // src/components/MentionPopover.jsx
14427
- import React28, { useEffect as useEffect22, useRef as useRef18, useState as useState26, useMemo as useMemo12 } from "react";
14461
+ import React28, { useEffect as useEffect22, useRef as useRef19, useState as useState26, useMemo as useMemo12 } from "react";
14428
14462
  import { FiLayers as FiLayers7, FiCheckSquare as FiCheckSquare3, FiGitBranch as FiGitBranch5, FiBox } from "react-icons/fi";
14429
14463
  var TYPE_CONFIG = {
14430
14464
  ancestry: { Icon: FiLayers7, color: "text-indigo-400", label: "Ancestralidade" },
@@ -14434,7 +14468,7 @@ var TYPE_CONFIG = {
14434
14468
  };
14435
14469
  function MentionPopover({ query, items, position, onSelect, onClose }) {
14436
14470
  const [activeIndex, setActiveIndex] = useState26(0);
14437
- const listRef = useRef18(null);
14471
+ const listRef = useRef19(null);
14438
14472
  const filtered = useMemo12(() => {
14439
14473
  const term = (query || "").toLowerCase().trim();
14440
14474
  if (!term) return items.slice(0, 8);
@@ -14574,9 +14608,9 @@ var RichGroupEditor = React29.memo(function RichGroupEditor2({
14574
14608
  readOnly,
14575
14609
  placeholder
14576
14610
  }) {
14577
- const editorRef = useRef19(null);
14578
- const isMountedRef = useRef19(false);
14579
- const dismissedTriggerRef = useRef19(null);
14611
+ const editorRef = useRef20(null);
14612
+ const isMountedRef = useRef20(false);
14613
+ const dismissedTriggerRef = useRef20(null);
14580
14614
  const [mentionState, setMentionState] = useState27(null);
14581
14615
  const [isEmpty, setIsEmpty] = useState27(true);
14582
14616
  useEffect23(() => {
@@ -15044,7 +15078,7 @@ function Boards({
15044
15078
  const [isLoaded, setIsLoaded] = useState28(false);
15045
15079
  const [saveStatus, setSaveStatus] = useState28("idle");
15046
15080
  const [navigationStack, setNavigationStack] = useState28([]);
15047
- const lastSavedBoardItemsRef = useRef20(null);
15081
+ const lastSavedBoardItemsRef = useRef21(null);
15048
15082
  const canEdit = useMemo13(() => userRole !== "viewer", [userRole]);
15049
15083
  const findGroupAndParent = (list, targetId, parent = null) => {
15050
15084
  for (let i = 0; i < list.length; i++) {
@@ -15695,10 +15729,10 @@ function XViewScene({
15695
15729
  }
15696
15730
  return null;
15697
15731
  }, [ownerId, sceneConfigId]);
15698
- const sceneDataRef = useRef21(null);
15699
- const parentDataRef = useRef21(null);
15732
+ const sceneDataRef = useRef22(null);
15733
+ const parentDataRef = useRef22(null);
15700
15734
  const graphDataRef = parentDataRef;
15701
- const ancestryDataRef = useRef21(null);
15735
+ const ancestryDataRef = useRef22(null);
15702
15736
  const [isLoading, setIsLoading] = useState30(true);
15703
15737
  const [permissionStatus, setPermissionStatus] = useState30("loading");
15704
15738
  const [userPermissionRole, setUserPermissionRole] = useState30(null);
@@ -15787,10 +15821,10 @@ function XViewScene({
15787
15821
  const [boardItems, setBoardItems] = useState30([]);
15788
15822
  const [isSidebarOpen, setIsSidebarOpen] = useState30(false);
15789
15823
  const [isMilestoneManagerOpen, setIsMilestoneManagerOpen] = useState30(false);
15790
- const mountRef = useRef21(null);
15791
- const tooltipRef = useRef21(null);
15792
- const formRef = useRef21(null);
15793
- const stateRef = useRef21({
15824
+ const mountRef = useRef22(null);
15825
+ const tooltipRef = useRef22(null);
15826
+ const formRef = useRef22(null);
15827
+ const stateRef = useRef22({
15794
15828
  readMode: {
15795
15829
  currentMaxIndex: 0,
15796
15830
  progressMap: {}
@@ -18488,84 +18522,6 @@ function XViewScene({
18488
18522
  alert("Ocorreu um erro ao criar a Quest.");
18489
18523
  }
18490
18524
  };
18491
- userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
18492
- const {
18493
- stateRef: stateRef2,
18494
- graphDataRef: graphDataRef2,
18495
- sceneDataRef: sceneDataRef2,
18496
- sceneConfigId: sceneConfigId2,
18497
- sceneSaveUrl: sceneSaveUrl2,
18498
- ownerId: ownerId2
18499
- } = context;
18500
- const { sourceNodeData } = stateRef2.current.connection;
18501
- if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
18502
- userActionHandlers.handleCancelConnection(context);
18503
- return;
18504
- }
18505
- const sourceParentInfo = getParentFileInfoForNode(
18506
- graphDataRef2.current,
18507
- sceneDataRef2.current,
18508
- sourceNodeData.id,
18509
- sceneConfigId2,
18510
- ownerId2
18511
- );
18512
- const targetParentInfo = getParentFileInfoForNode(
18513
- graphDataRef2.current,
18514
- sceneDataRef2.current,
18515
- targetNodeData.id,
18516
- sceneConfigId2,
18517
- ownerId2
18518
- );
18519
- let parentInfoToSave = sourceParentInfo;
18520
- const isSourceQuest = sourceParentInfo.parentFileId === sceneConfigId2;
18521
- const isTargetQuest = targetParentInfo.parentFileId === sceneConfigId2;
18522
- if (isSourceQuest || isTargetQuest) {
18523
- parentInfoToSave = { parentFileId: sceneConfigId2, ownerId: ownerId2 };
18524
- }
18525
- const { parentFileId: parentFileIdToSave, ownerId: ownerIdToSave } = parentInfoToSave;
18526
- const newLink = {
18527
- id: `link_${short2.generate()}`,
18528
- source: sourceNodeData.id,
18529
- target: targetNodeData.id
18530
- };
18531
- try {
18532
- if (parentFileIdToSave === sceneConfigId2) {
18533
- const specificParentData = graphDataRef2.current[sceneConfigId2];
18534
- specificParentData.links.push(newLink);
18535
- const viewFilePayload = {
18536
- ...sceneDataRef2.current,
18537
- quest_counter: sceneDataRef2.current.quest_counter || 1
18538
- };
18539
- const questFilePayload = {
18540
- nodes: specificParentData.nodes,
18541
- links: specificParentData.links,
18542
- milestones: sceneDataRef2.current.milestones || []
18543
- };
18544
- await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
18545
- const questSaveUrl = sceneSaveUrl2.replace(
18546
- "x_view_scenes",
18547
- "x_view_quests"
18548
- );
18549
- await context.actions.save_view_data(questSaveUrl, questFilePayload);
18550
- } else {
18551
- const specificParentData = JSON.parse(
18552
- JSON.stringify(graphDataRef2.current[parentFileIdToSave])
18553
- );
18554
- specificParentData.links.push(newLink);
18555
- const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
18556
- await context.actions.save_view_data(
18557
- filenameForSpecificParent,
18558
- specificParentData
18559
- );
18560
- graphDataRef2.current[parentFileIdToSave] = specificParentData;
18561
- }
18562
- addNewLinkToScene(stateRef2.current, newLink);
18563
- } catch (error) {
18564
- console.error("Falha ao salvar a nova conex\xE3o:", error);
18565
- alert("Ocorreu um erro ao salvar a nova conex\xE3o.");
18566
- }
18567
- userActionHandlers.handleCancelConnection(context);
18568
- };
18569
18525
  const handleClearAncestryVisuals = useCallback7((ancestryId) => {
18570
18526
  const { renderedAncestries, ancestryGroup } = stateRef.current;
18571
18527
  const renderIndex = renderedAncestries.findIndex(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.8-dev.11",
3
+ "version": "1.2.8-dev.13",
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",