@lv-x-software-house/x_view 1.2.6-dev.30 → 1.2.6-dev.32

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.
Files changed (3) hide show
  1. package/dist/index.js +146 -138
  2. package/dist/index.mjs +185 -177
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13069,7 +13069,7 @@ function domToContent(el) {
13069
13069
  el.childNodes.forEach(walk);
13070
13070
  return segments;
13071
13071
  }
13072
- function RichGroupEditor({
13072
+ var RichGroupEditor = import_react28.default.memo(function RichGroupEditor2({
13073
13073
  content,
13074
13074
  onChange,
13075
13075
  onMentionClick,
@@ -13279,14 +13279,17 @@ function RichGroupEditor({
13279
13279
  onClose: handleMentionDismiss
13280
13280
  }
13281
13281
  ));
13282
- }
13282
+ }, (prevProps, nextProps) => {
13283
+ return prevProps.readOnly === nextProps.readOnly && prevProps.placeholder === nextProps.placeholder && prevProps.content === nextProps.content && prevProps.searchItems === nextProps.searchItems;
13284
+ });
13285
+ var RichGroupEditor_default = RichGroupEditor;
13283
13286
 
13284
13287
  // src/components/Boards.jsx
13285
13288
  var Tooltip = ({ text, children }) => {
13286
13289
  if (!text) return children;
13287
13290
  return /* @__PURE__ */ import_react29.default.createElement("div", { className: "relative group/tooltip" }, children, /* @__PURE__ */ import_react29.default.createElement("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-slate-900 border border-white/10 text-white text-[10px] rounded opacity-0 group-hover/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-[3000] shadow-2xl" }, text));
13288
13291
  };
13289
- var BoardItem = ({
13292
+ var BoardItem = import_react29.default.memo(({
13290
13293
  item,
13291
13294
  index,
13292
13295
  prevItem,
@@ -13309,7 +13312,6 @@ var BoardItem = ({
13309
13312
  const isFolder = item.type === "folder";
13310
13313
  const canMoveUp = index > 0;
13311
13314
  const canMoveDown = nextItem !== void 0;
13312
- const isNested = onOutdent !== void 0;
13313
13315
  const getIndentUpTooltip = () => {
13314
13316
  if (!prevItem) return null;
13315
13317
  const typeLabel = prevItem.type === "folder" ? "pasta" : "grupo de texto";
@@ -13414,7 +13416,7 @@ var BoardItem = ({
13414
13416
  ));
13415
13417
  }
13416
13418
  return /* @__PURE__ */ import_react29.default.createElement("div", { className: "flex flex-col gap-2 mb-3 pl-3 border-l border-white/10 relative group/item animate-in fade-in slide-in-from-left-2 duration-300" }, /* @__PURE__ */ import_react29.default.createElement("div", { className: "absolute -left-[1px] top-4 w-2 h-px bg-white/20" }), /* @__PURE__ */ import_react29.default.createElement("div", { className: "flex flex-col gap-2 py-2 px-3 transition-all duration-200 hover:bg-white/5 border-l-2 border-transparent hover:border-white/20" }, /* @__PURE__ */ import_react29.default.createElement(
13417
- RichGroupEditor,
13419
+ RichGroupEditor_default,
13418
13420
  {
13419
13421
  content: item.content,
13420
13422
  onChange: handleContentChange,
@@ -13500,7 +13502,7 @@ var BoardItem = ({
13500
13502
  isAtRoot: false
13501
13503
  }
13502
13504
  ))));
13503
- };
13505
+ });
13504
13506
  function Boards({
13505
13507
  isOpen,
13506
13508
  onClose,
@@ -13517,13 +13519,24 @@ function Boards({
13517
13519
  const [navigationStack, setNavigationStack] = (0, import_react29.useState)([]);
13518
13520
  const lastSavedBoardItemsRef = (0, import_react29.useRef)(null);
13519
13521
  const canEdit = (0, import_react29.useMemo)(() => userRole !== "viewer", [userRole]);
13520
- const sanitizeBoardItems = (list) => list.map((g) => ({
13522
+ const findGroupAndParent = (list, targetId, parent = null) => {
13523
+ for (let i = 0; i < list.length; i++) {
13524
+ if (list[i].id === targetId)
13525
+ return { group: list[i], parent, index: i, siblings: list };
13526
+ if (list[i].children.length > 0) {
13527
+ const found = findGroupAndParent(list[i].children, targetId, list[i]);
13528
+ if (found) return found;
13529
+ }
13530
+ }
13531
+ return null;
13532
+ };
13533
+ const sanitizeBoardItems = (0, import_react29.useCallback)((list) => list.map((g) => ({
13521
13534
  id: g.id,
13522
13535
  type: g.type || "text_group",
13523
13536
  name: g.name || "",
13524
13537
  content: g.content || [],
13525
13538
  children: sanitizeBoardItems(g.children || [])
13526
- }));
13539
+ })), []);
13527
13540
  (0, import_react29.useEffect)(() => {
13528
13541
  if (initialBoardItems && !isLoaded) {
13529
13542
  const hasLegacyTypes = (list) => list.some(
@@ -13594,8 +13607,8 @@ function Boards({
13594
13607
  }
13595
13608
  }, 3e3);
13596
13609
  return () => clearTimeout(id);
13597
- }, [boardItems, isLoaded, onSave]);
13598
- const triggerInstantSave = async (updatedBoardItems) => {
13610
+ }, [boardItems, isLoaded, onSave, sanitizeBoardItems]);
13611
+ const triggerInstantSave = (0, import_react29.useCallback)(async (updatedBoardItems) => {
13599
13612
  if (!onSave) return;
13600
13613
  const sanitized = sanitizeBoardItems(updatedBoardItems);
13601
13614
  const sanitizedJson = JSON.stringify(sanitized);
@@ -13609,7 +13622,7 @@ function Boards({
13609
13622
  console.error("Erro ao salvar board:", err);
13610
13623
  setSaveStatus("error");
13611
13624
  }
13612
- };
13625
+ }, [onSave, sanitizeBoardItems]);
13613
13626
  (0, import_react29.useEffect)(() => {
13614
13627
  if (!isOpen) return;
13615
13628
  const handler = (e) => {
@@ -13638,19 +13651,7 @@ function Boards({
13638
13651
  const lastFolder = currentPath[currentPath.length - 1];
13639
13652
  return lastFolder ? lastFolder.children : boardItems;
13640
13653
  }, [boardItems, currentPath]);
13641
- const navigateUp = () => {
13642
- setNavigationStack((prev) => prev.slice(0, -1));
13643
- };
13644
- const navigateTo = (folderId) => {
13645
- setNavigationStack((prev) => [...prev, folderId]);
13646
- };
13647
- const navigateToBreadcrumb = (index) => {
13648
- setNavigationStack((prev) => prev.slice(0, index + 1));
13649
- };
13650
- const navigateHome = () => {
13651
- setNavigationStack([]);
13652
- };
13653
- const handleAddItem = (type = "text_group") => {
13654
+ const handleAddItem = (0, import_react29.useCallback)((type = "text_group") => {
13654
13655
  const newItem = {
13655
13656
  id: (0, import_uuid11.v4)(),
13656
13657
  type,
@@ -13658,17 +13659,20 @@ function Boards({
13658
13659
  content: [],
13659
13660
  children: []
13660
13661
  };
13661
- if (navigationStack.length === 0) {
13662
- setBoardItems((prev) => [...prev, newItem]);
13663
- } else {
13664
- const parentId = navigationStack[navigationStack.length - 1];
13665
- const add = (list) => list.map(
13666
- (g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
13667
- );
13668
- setBoardItems((prev) => add(prev));
13669
- }
13670
- };
13671
- const handleAddSubgroup = (parentId, type = "text_group") => {
13662
+ setNavigationStack((stack) => {
13663
+ if (stack.length === 0) {
13664
+ setBoardItems((prev) => [...prev, newItem]);
13665
+ } else {
13666
+ const parentId = stack[stack.length - 1];
13667
+ const add = (list) => list.map(
13668
+ (g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
13669
+ );
13670
+ setBoardItems((prev) => add(prev));
13671
+ }
13672
+ return stack;
13673
+ });
13674
+ }, []);
13675
+ const handleAddSubgroup = (0, import_react29.useCallback)((parentId, type = "text_group") => {
13672
13676
  const add = (list) => list.map((g) => {
13673
13677
  if (g.id === parentId) {
13674
13678
  if (g.type === "text_group" && type === "folder") return g;
@@ -13684,96 +13688,103 @@ function Boards({
13684
13688
  return { ...g, children: add(g.children) };
13685
13689
  });
13686
13690
  setBoardItems((prev) => add(prev));
13687
- };
13688
- const handleUpdateItem = (id, newData) => {
13691
+ }, []);
13692
+ const handleUpdateItem = (0, import_react29.useCallback)((id, newData) => {
13689
13693
  const update = (list) => list.map(
13690
13694
  (g) => g.id === id ? newData : { ...g, children: update(g.children) }
13691
13695
  );
13692
13696
  setBoardItems((prev) => update(prev));
13693
- };
13694
- const handleDeleteItem = (id) => {
13697
+ }, []);
13698
+ const handleDeleteItem = (0, import_react29.useCallback)((id) => {
13695
13699
  const del = (list) => list.filter((g) => g.id !== id).map((g) => ({ ...g, children: del(g.children) }));
13696
13700
  setBoardItems((prev) => del(prev));
13697
- };
13698
- const findGroupAndParent = (list, targetId, parent = null) => {
13699
- for (let i = 0; i < list.length; i++) {
13700
- if (list[i].id === targetId)
13701
- return { group: list[i], parent, index: i, siblings: list };
13702
- if (list[i].children.length > 0) {
13703
- const found = findGroupAndParent(list[i].children, targetId, list[i]);
13704
- if (found) return found;
13701
+ }, []);
13702
+ const handleIndent = (0, import_react29.useCallback)((id) => {
13703
+ setBoardItems((prev) => {
13704
+ const next = JSON.parse(JSON.stringify(prev));
13705
+ const found = findGroupAndParent(next, id);
13706
+ if (!found || found.index === 0) return prev;
13707
+ const { group, siblings, index } = found;
13708
+ const targetParent = siblings[index - 1];
13709
+ if (group.type === "folder" && targetParent.type === "text_group") return prev;
13710
+ siblings.splice(index, 1);
13711
+ targetParent.children.push(group);
13712
+ triggerInstantSave(next);
13713
+ return next;
13714
+ });
13715
+ }, [triggerInstantSave]);
13716
+ const handleIndentDown = (0, import_react29.useCallback)((id) => {
13717
+ setBoardItems((prev) => {
13718
+ const next = JSON.parse(JSON.stringify(prev));
13719
+ const found = findGroupAndParent(next, id);
13720
+ if (!found || found.index === found.siblings.length - 1) return prev;
13721
+ const { group, siblings, index } = found;
13722
+ const targetParent = siblings[index + 1];
13723
+ if (group.type === "folder" && targetParent.type === "text_group") return prev;
13724
+ siblings.splice(index, 1);
13725
+ targetParent.children.push(group);
13726
+ triggerInstantSave(next);
13727
+ return next;
13728
+ });
13729
+ }, [triggerInstantSave]);
13730
+ const handleOutdent = (0, import_react29.useCallback)((id) => {
13731
+ setBoardItems((prev) => {
13732
+ const next = JSON.parse(JSON.stringify(prev));
13733
+ const found = findGroupAndParent(next, id);
13734
+ if (!found || !found.parent) return prev;
13735
+ const { group, siblings, index, parent } = found;
13736
+ siblings.splice(index, 1);
13737
+ const parentFound = findGroupAndParent(next, parent.id);
13738
+ if (parentFound) {
13739
+ parentFound.siblings.splice(parentFound.index + 1, 0, group);
13740
+ } else {
13741
+ next.push(group);
13705
13742
  }
13706
- }
13707
- return null;
13708
- };
13709
- const handleIndent = (id) => {
13710
- const next = JSON.parse(JSON.stringify(boardItems));
13711
- const found = findGroupAndParent(next, id);
13712
- if (!found || found.index === 0) return;
13713
- const { group, siblings, index } = found;
13714
- const targetParent = siblings[index - 1];
13715
- if (group.type === "folder" && targetParent.type === "text_group") {
13716
- return;
13717
- }
13718
- siblings.splice(index, 1);
13719
- targetParent.children.push(group);
13720
- setBoardItems(next);
13721
- triggerInstantSave(next);
13722
- };
13723
- const handleIndentDown = (id) => {
13724
- const next = JSON.parse(JSON.stringify(boardItems));
13725
- const found = findGroupAndParent(next, id);
13726
- if (!found || found.index === found.siblings.length - 1) return;
13727
- const { group, siblings, index } = found;
13728
- const targetParent = siblings[index + 1];
13729
- if (group.type === "folder" && targetParent.type === "text_group") {
13730
- return;
13731
- }
13732
- siblings.splice(index, 1);
13733
- targetParent.children.push(group);
13734
- setBoardItems(next);
13735
- triggerInstantSave(next);
13736
- };
13737
- const handleOutdent = (id) => {
13738
- const next = JSON.parse(JSON.stringify(boardItems));
13739
- const found = findGroupAndParent(next, id);
13740
- if (!found || !found.parent) return;
13741
- const { group, siblings, index, parent } = found;
13742
- siblings.splice(index, 1);
13743
- const parentFound = findGroupAndParent(next, parent.id);
13744
- if (parentFound) {
13745
- parentFound.siblings.splice(parentFound.index + 1, 0, group);
13746
- } else {
13747
- next.push(group);
13748
- }
13749
- setBoardItems(next);
13750
- triggerInstantSave(next);
13751
- };
13752
- const handleMoveUp = (id) => {
13753
- const next = JSON.parse(JSON.stringify(boardItems));
13754
- const found = findGroupAndParent(next, id);
13755
- if (!found || found.index === 0) return;
13756
- const { siblings, index } = found;
13757
- const item = siblings[index];
13758
- siblings.splice(index, 1);
13759
- siblings.splice(index - 1, 0, item);
13760
- setBoardItems(next);
13761
- triggerInstantSave(next);
13762
- };
13763
- const handleMoveDown = (id) => {
13764
- const next = JSON.parse(JSON.stringify(boardItems));
13765
- const found = findGroupAndParent(next, id);
13766
- if (!found || found.index === found.siblings.length - 1) return;
13767
- const { siblings, index } = found;
13768
- const item = siblings[index];
13769
- siblings.splice(index, 1);
13770
- siblings.splice(index + 1, 0, item);
13771
- setBoardItems(next);
13772
- triggerInstantSave(next);
13773
- };
13774
- const handleMentionClick = (item) => {
13743
+ triggerInstantSave(next);
13744
+ return next;
13745
+ });
13746
+ }, [triggerInstantSave]);
13747
+ const handleMoveUp = (0, import_react29.useCallback)((id) => {
13748
+ setBoardItems((prev) => {
13749
+ const next = JSON.parse(JSON.stringify(prev));
13750
+ const found = findGroupAndParent(next, id);
13751
+ if (!found || found.index === 0) return prev;
13752
+ const { siblings, index } = found;
13753
+ const item = siblings[index];
13754
+ siblings.splice(index, 1);
13755
+ siblings.splice(index - 1, 0, item);
13756
+ triggerInstantSave(next);
13757
+ return next;
13758
+ });
13759
+ }, [triggerInstantSave]);
13760
+ const handleMoveDown = (0, import_react29.useCallback)((id) => {
13761
+ setBoardItems((prev) => {
13762
+ const next = JSON.parse(JSON.stringify(prev));
13763
+ const found = findGroupAndParent(next, id);
13764
+ if (!found || found.index === found.siblings.length - 1) return prev;
13765
+ const { siblings, index } = found;
13766
+ const item = siblings[index];
13767
+ siblings.splice(index, 1);
13768
+ siblings.splice(index + 1, 0, item);
13769
+ triggerInstantSave(next);
13770
+ return next;
13771
+ });
13772
+ }, [triggerInstantSave]);
13773
+ const handleMentionClick = (0, import_react29.useCallback)((item) => {
13775
13774
  if (onSelect) onSelect(item);
13776
- };
13775
+ }, [onSelect]);
13776
+ const navigateUp = (0, import_react29.useCallback)(() => {
13777
+ setNavigationStack((prev) => prev.slice(0, -1));
13778
+ }, []);
13779
+ const navigateTo = (0, import_react29.useCallback)((folderId) => {
13780
+ setNavigationStack((prev) => [...prev, folderId]);
13781
+ }, []);
13782
+ const navigateToBreadcrumb = (0, import_react29.useCallback)((index) => {
13783
+ setNavigationStack((prev) => prev.slice(0, index + 1));
13784
+ }, []);
13785
+ const navigateHome = (0, import_react29.useCallback)(() => {
13786
+ setNavigationStack([]);
13787
+ }, []);
13777
13788
  if (!isOpen) return null;
13778
13789
  return /* @__PURE__ */ import_react29.default.createElement(
13779
13790
  "div",
@@ -18044,6 +18055,22 @@ function XViewScene({
18044
18055
  const allAvailableAncestries = (0, import_react31.useMemo)(() => {
18045
18056
  return ancestryDataRef.current || [];
18046
18057
  }, [sceneVersion, isInitialized]);
18058
+ const handleFocusNode = (0, import_react31.useCallback)(
18059
+ (nodeData) => {
18060
+ var _a2;
18061
+ if (!nodeData) return;
18062
+ let nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18063
+ if (!nodeMesh) {
18064
+ const spawnPos = ((_a2 = stateRef.current.controls) == null ? void 0 : _a2.target.clone()) || new THREE3.Vector3();
18065
+ addStandaloneNodeToScene(stateRef.current, nodeData, spawnPos);
18066
+ nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18067
+ }
18068
+ if (nodeMesh) {
18069
+ tweenToTarget(nodeMesh, 1.2);
18070
+ }
18071
+ },
18072
+ [tweenToTarget]
18073
+ );
18047
18074
  const handleOpenReference = (0, import_react31.useCallback)(
18048
18075
  (referenceData) => {
18049
18076
  const { type, id } = referenceData;
@@ -18055,10 +18082,7 @@ function XViewScene({
18055
18082
  setAncestryLinkDetails(null);
18056
18083
  setDetailsLink(null);
18057
18084
  setDetailsNode(targetNode);
18058
- const sceneMesh = stateRef.current.nodeObjects[String(id)];
18059
- if (sceneMesh) {
18060
- tweenToTarget(sceneMesh);
18061
- }
18085
+ handleFocusNode(targetNode);
18062
18086
  } else {
18063
18087
  alert("Node original n\xE3o encontrado neste contexto.");
18064
18088
  }
@@ -18080,7 +18104,7 @@ function XViewScene({
18080
18104
  allAvailableNodes,
18081
18105
  allAvailableAncestries,
18082
18106
  handleEditAncestry,
18083
- tweenToTarget
18107
+ handleFocusNode
18084
18108
  ]
18085
18109
  );
18086
18110
  const handleSelectAncestryFromBoard = (0, import_react31.useCallback)(
@@ -18240,22 +18264,6 @@ function XViewScene({
18240
18264
  isAddingNodes: !prev.isAddingNodes
18241
18265
  }));
18242
18266
  }, []);
18243
- const handleFocusNode = (0, import_react31.useCallback)(
18244
- (nodeData) => {
18245
- var _a2;
18246
- if (!nodeData) return;
18247
- let nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18248
- if (!nodeMesh) {
18249
- const spawnPos = ((_a2 = stateRef.current.controls) == null ? void 0 : _a2.target.clone()) || new THREE3.Vector3();
18250
- addStandaloneNodeToScene(stateRef.current, nodeData, spawnPos);
18251
- nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18252
- }
18253
- if (nodeMesh) {
18254
- tweenToTarget(nodeMesh, 1.2);
18255
- }
18256
- },
18257
- [tweenToTarget]
18258
- );
18259
18267
  const availableDatasets = (0, import_react31.useMemo)(() => {
18260
18268
  if (!sceneDataRef.current || !parentDataRef.current) return [];
18261
18269
  return sceneDataRef.current.parent_dbs.map((db) => {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/XViewScene.jsx
2
2
  import React30, {
3
- useCallback as useCallback5,
3
+ useCallback as useCallback6,
4
4
  useEffect as useEffect24,
5
5
  useRef as useRef21,
6
6
  useState as useState29,
@@ -12950,7 +12950,7 @@ function AncestryLinkDetailsPanel({ data, onClose, onOpenImageViewer, onOpenRefe
12950
12950
  }
12951
12951
 
12952
12952
  // src/components/Boards.jsx
12953
- import React28, { useState as useState27, useMemo as useMemo12, useEffect as useEffect23, useRef as useRef20 } from "react";
12953
+ import React28, { useState as useState27, useMemo as useMemo12, useEffect as useEffect23, useRef as useRef20, useCallback as useCallback5 } from "react";
12954
12954
  import {
12955
12955
  FiSearch as FiSearch8,
12956
12956
  FiLayers as FiLayers7,
@@ -13119,7 +13119,7 @@ function domToContent(el) {
13119
13119
  el.childNodes.forEach(walk);
13120
13120
  return segments;
13121
13121
  }
13122
- function RichGroupEditor({
13122
+ var RichGroupEditor = React27.memo(function RichGroupEditor2({
13123
13123
  content,
13124
13124
  onChange,
13125
13125
  onMentionClick,
@@ -13329,14 +13329,17 @@ function RichGroupEditor({
13329
13329
  onClose: handleMentionDismiss
13330
13330
  }
13331
13331
  ));
13332
- }
13332
+ }, (prevProps, nextProps) => {
13333
+ return prevProps.readOnly === nextProps.readOnly && prevProps.placeholder === nextProps.placeholder && prevProps.content === nextProps.content && prevProps.searchItems === nextProps.searchItems;
13334
+ });
13335
+ var RichGroupEditor_default = RichGroupEditor;
13333
13336
 
13334
13337
  // src/components/Boards.jsx
13335
13338
  var Tooltip = ({ text, children }) => {
13336
13339
  if (!text) return children;
13337
13340
  return /* @__PURE__ */ React28.createElement("div", { className: "relative group/tooltip" }, children, /* @__PURE__ */ React28.createElement("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-slate-900 border border-white/10 text-white text-[10px] rounded opacity-0 group-hover/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-[3000] shadow-2xl" }, text));
13338
13341
  };
13339
- var BoardItem = ({
13342
+ var BoardItem = React28.memo(({
13340
13343
  item,
13341
13344
  index,
13342
13345
  prevItem,
@@ -13359,7 +13362,6 @@ var BoardItem = ({
13359
13362
  const isFolder = item.type === "folder";
13360
13363
  const canMoveUp = index > 0;
13361
13364
  const canMoveDown = nextItem !== void 0;
13362
- const isNested = onOutdent !== void 0;
13363
13365
  const getIndentUpTooltip = () => {
13364
13366
  if (!prevItem) return null;
13365
13367
  const typeLabel = prevItem.type === "folder" ? "pasta" : "grupo de texto";
@@ -13464,7 +13466,7 @@ var BoardItem = ({
13464
13466
  ));
13465
13467
  }
13466
13468
  return /* @__PURE__ */ React28.createElement("div", { className: "flex flex-col gap-2 mb-3 pl-3 border-l border-white/10 relative group/item animate-in fade-in slide-in-from-left-2 duration-300" }, /* @__PURE__ */ React28.createElement("div", { className: "absolute -left-[1px] top-4 w-2 h-px bg-white/20" }), /* @__PURE__ */ React28.createElement("div", { className: "flex flex-col gap-2 py-2 px-3 transition-all duration-200 hover:bg-white/5 border-l-2 border-transparent hover:border-white/20" }, /* @__PURE__ */ React28.createElement(
13467
- RichGroupEditor,
13469
+ RichGroupEditor_default,
13468
13470
  {
13469
13471
  content: item.content,
13470
13472
  onChange: handleContentChange,
@@ -13550,7 +13552,7 @@ var BoardItem = ({
13550
13552
  isAtRoot: false
13551
13553
  }
13552
13554
  ))));
13553
- };
13555
+ });
13554
13556
  function Boards({
13555
13557
  isOpen,
13556
13558
  onClose,
@@ -13567,13 +13569,24 @@ function Boards({
13567
13569
  const [navigationStack, setNavigationStack] = useState27([]);
13568
13570
  const lastSavedBoardItemsRef = useRef20(null);
13569
13571
  const canEdit = useMemo12(() => userRole !== "viewer", [userRole]);
13570
- const sanitizeBoardItems = (list) => list.map((g) => ({
13572
+ const findGroupAndParent = (list, targetId, parent = null) => {
13573
+ for (let i = 0; i < list.length; i++) {
13574
+ if (list[i].id === targetId)
13575
+ return { group: list[i], parent, index: i, siblings: list };
13576
+ if (list[i].children.length > 0) {
13577
+ const found = findGroupAndParent(list[i].children, targetId, list[i]);
13578
+ if (found) return found;
13579
+ }
13580
+ }
13581
+ return null;
13582
+ };
13583
+ const sanitizeBoardItems = useCallback5((list) => list.map((g) => ({
13571
13584
  id: g.id,
13572
13585
  type: g.type || "text_group",
13573
13586
  name: g.name || "",
13574
13587
  content: g.content || [],
13575
13588
  children: sanitizeBoardItems(g.children || [])
13576
- }));
13589
+ })), []);
13577
13590
  useEffect23(() => {
13578
13591
  if (initialBoardItems && !isLoaded) {
13579
13592
  const hasLegacyTypes = (list) => list.some(
@@ -13644,8 +13657,8 @@ function Boards({
13644
13657
  }
13645
13658
  }, 3e3);
13646
13659
  return () => clearTimeout(id);
13647
- }, [boardItems, isLoaded, onSave]);
13648
- const triggerInstantSave = async (updatedBoardItems) => {
13660
+ }, [boardItems, isLoaded, onSave, sanitizeBoardItems]);
13661
+ const triggerInstantSave = useCallback5(async (updatedBoardItems) => {
13649
13662
  if (!onSave) return;
13650
13663
  const sanitized = sanitizeBoardItems(updatedBoardItems);
13651
13664
  const sanitizedJson = JSON.stringify(sanitized);
@@ -13659,7 +13672,7 @@ function Boards({
13659
13672
  console.error("Erro ao salvar board:", err);
13660
13673
  setSaveStatus("error");
13661
13674
  }
13662
- };
13675
+ }, [onSave, sanitizeBoardItems]);
13663
13676
  useEffect23(() => {
13664
13677
  if (!isOpen) return;
13665
13678
  const handler = (e) => {
@@ -13688,19 +13701,7 @@ function Boards({
13688
13701
  const lastFolder = currentPath[currentPath.length - 1];
13689
13702
  return lastFolder ? lastFolder.children : boardItems;
13690
13703
  }, [boardItems, currentPath]);
13691
- const navigateUp = () => {
13692
- setNavigationStack((prev) => prev.slice(0, -1));
13693
- };
13694
- const navigateTo = (folderId) => {
13695
- setNavigationStack((prev) => [...prev, folderId]);
13696
- };
13697
- const navigateToBreadcrumb = (index) => {
13698
- setNavigationStack((prev) => prev.slice(0, index + 1));
13699
- };
13700
- const navigateHome = () => {
13701
- setNavigationStack([]);
13702
- };
13703
- const handleAddItem = (type = "text_group") => {
13704
+ const handleAddItem = useCallback5((type = "text_group") => {
13704
13705
  const newItem = {
13705
13706
  id: uuidv411(),
13706
13707
  type,
@@ -13708,17 +13709,20 @@ function Boards({
13708
13709
  content: [],
13709
13710
  children: []
13710
13711
  };
13711
- if (navigationStack.length === 0) {
13712
- setBoardItems((prev) => [...prev, newItem]);
13713
- } else {
13714
- const parentId = navigationStack[navigationStack.length - 1];
13715
- const add = (list) => list.map(
13716
- (g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
13717
- );
13718
- setBoardItems((prev) => add(prev));
13719
- }
13720
- };
13721
- const handleAddSubgroup = (parentId, type = "text_group") => {
13712
+ setNavigationStack((stack) => {
13713
+ if (stack.length === 0) {
13714
+ setBoardItems((prev) => [...prev, newItem]);
13715
+ } else {
13716
+ const parentId = stack[stack.length - 1];
13717
+ const add = (list) => list.map(
13718
+ (g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
13719
+ );
13720
+ setBoardItems((prev) => add(prev));
13721
+ }
13722
+ return stack;
13723
+ });
13724
+ }, []);
13725
+ const handleAddSubgroup = useCallback5((parentId, type = "text_group") => {
13722
13726
  const add = (list) => list.map((g) => {
13723
13727
  if (g.id === parentId) {
13724
13728
  if (g.type === "text_group" && type === "folder") return g;
@@ -13734,96 +13738,103 @@ function Boards({
13734
13738
  return { ...g, children: add(g.children) };
13735
13739
  });
13736
13740
  setBoardItems((prev) => add(prev));
13737
- };
13738
- const handleUpdateItem = (id, newData) => {
13741
+ }, []);
13742
+ const handleUpdateItem = useCallback5((id, newData) => {
13739
13743
  const update = (list) => list.map(
13740
13744
  (g) => g.id === id ? newData : { ...g, children: update(g.children) }
13741
13745
  );
13742
13746
  setBoardItems((prev) => update(prev));
13743
- };
13744
- const handleDeleteItem = (id) => {
13747
+ }, []);
13748
+ const handleDeleteItem = useCallback5((id) => {
13745
13749
  const del = (list) => list.filter((g) => g.id !== id).map((g) => ({ ...g, children: del(g.children) }));
13746
13750
  setBoardItems((prev) => del(prev));
13747
- };
13748
- const findGroupAndParent = (list, targetId, parent = null) => {
13749
- for (let i = 0; i < list.length; i++) {
13750
- if (list[i].id === targetId)
13751
- return { group: list[i], parent, index: i, siblings: list };
13752
- if (list[i].children.length > 0) {
13753
- const found = findGroupAndParent(list[i].children, targetId, list[i]);
13754
- if (found) return found;
13751
+ }, []);
13752
+ const handleIndent = useCallback5((id) => {
13753
+ setBoardItems((prev) => {
13754
+ const next = JSON.parse(JSON.stringify(prev));
13755
+ const found = findGroupAndParent(next, id);
13756
+ if (!found || found.index === 0) return prev;
13757
+ const { group, siblings, index } = found;
13758
+ const targetParent = siblings[index - 1];
13759
+ if (group.type === "folder" && targetParent.type === "text_group") return prev;
13760
+ siblings.splice(index, 1);
13761
+ targetParent.children.push(group);
13762
+ triggerInstantSave(next);
13763
+ return next;
13764
+ });
13765
+ }, [triggerInstantSave]);
13766
+ const handleIndentDown = useCallback5((id) => {
13767
+ setBoardItems((prev) => {
13768
+ const next = JSON.parse(JSON.stringify(prev));
13769
+ const found = findGroupAndParent(next, id);
13770
+ if (!found || found.index === found.siblings.length - 1) return prev;
13771
+ const { group, siblings, index } = found;
13772
+ const targetParent = siblings[index + 1];
13773
+ if (group.type === "folder" && targetParent.type === "text_group") return prev;
13774
+ siblings.splice(index, 1);
13775
+ targetParent.children.push(group);
13776
+ triggerInstantSave(next);
13777
+ return next;
13778
+ });
13779
+ }, [triggerInstantSave]);
13780
+ const handleOutdent = useCallback5((id) => {
13781
+ setBoardItems((prev) => {
13782
+ const next = JSON.parse(JSON.stringify(prev));
13783
+ const found = findGroupAndParent(next, id);
13784
+ if (!found || !found.parent) return prev;
13785
+ const { group, siblings, index, parent } = found;
13786
+ siblings.splice(index, 1);
13787
+ const parentFound = findGroupAndParent(next, parent.id);
13788
+ if (parentFound) {
13789
+ parentFound.siblings.splice(parentFound.index + 1, 0, group);
13790
+ } else {
13791
+ next.push(group);
13755
13792
  }
13756
- }
13757
- return null;
13758
- };
13759
- const handleIndent = (id) => {
13760
- const next = JSON.parse(JSON.stringify(boardItems));
13761
- const found = findGroupAndParent(next, id);
13762
- if (!found || found.index === 0) return;
13763
- const { group, siblings, index } = found;
13764
- const targetParent = siblings[index - 1];
13765
- if (group.type === "folder" && targetParent.type === "text_group") {
13766
- return;
13767
- }
13768
- siblings.splice(index, 1);
13769
- targetParent.children.push(group);
13770
- setBoardItems(next);
13771
- triggerInstantSave(next);
13772
- };
13773
- const handleIndentDown = (id) => {
13774
- const next = JSON.parse(JSON.stringify(boardItems));
13775
- const found = findGroupAndParent(next, id);
13776
- if (!found || found.index === found.siblings.length - 1) return;
13777
- const { group, siblings, index } = found;
13778
- const targetParent = siblings[index + 1];
13779
- if (group.type === "folder" && targetParent.type === "text_group") {
13780
- return;
13781
- }
13782
- siblings.splice(index, 1);
13783
- targetParent.children.push(group);
13784
- setBoardItems(next);
13785
- triggerInstantSave(next);
13786
- };
13787
- const handleOutdent = (id) => {
13788
- const next = JSON.parse(JSON.stringify(boardItems));
13789
- const found = findGroupAndParent(next, id);
13790
- if (!found || !found.parent) return;
13791
- const { group, siblings, index, parent } = found;
13792
- siblings.splice(index, 1);
13793
- const parentFound = findGroupAndParent(next, parent.id);
13794
- if (parentFound) {
13795
- parentFound.siblings.splice(parentFound.index + 1, 0, group);
13796
- } else {
13797
- next.push(group);
13798
- }
13799
- setBoardItems(next);
13800
- triggerInstantSave(next);
13801
- };
13802
- const handleMoveUp = (id) => {
13803
- const next = JSON.parse(JSON.stringify(boardItems));
13804
- const found = findGroupAndParent(next, id);
13805
- if (!found || found.index === 0) return;
13806
- const { siblings, index } = found;
13807
- const item = siblings[index];
13808
- siblings.splice(index, 1);
13809
- siblings.splice(index - 1, 0, item);
13810
- setBoardItems(next);
13811
- triggerInstantSave(next);
13812
- };
13813
- const handleMoveDown = (id) => {
13814
- const next = JSON.parse(JSON.stringify(boardItems));
13815
- const found = findGroupAndParent(next, id);
13816
- if (!found || found.index === found.siblings.length - 1) return;
13817
- const { siblings, index } = found;
13818
- const item = siblings[index];
13819
- siblings.splice(index, 1);
13820
- siblings.splice(index + 1, 0, item);
13821
- setBoardItems(next);
13822
- triggerInstantSave(next);
13823
- };
13824
- const handleMentionClick = (item) => {
13793
+ triggerInstantSave(next);
13794
+ return next;
13795
+ });
13796
+ }, [triggerInstantSave]);
13797
+ const handleMoveUp = useCallback5((id) => {
13798
+ setBoardItems((prev) => {
13799
+ const next = JSON.parse(JSON.stringify(prev));
13800
+ const found = findGroupAndParent(next, id);
13801
+ if (!found || found.index === 0) return prev;
13802
+ const { siblings, index } = found;
13803
+ const item = siblings[index];
13804
+ siblings.splice(index, 1);
13805
+ siblings.splice(index - 1, 0, item);
13806
+ triggerInstantSave(next);
13807
+ return next;
13808
+ });
13809
+ }, [triggerInstantSave]);
13810
+ const handleMoveDown = useCallback5((id) => {
13811
+ setBoardItems((prev) => {
13812
+ const next = JSON.parse(JSON.stringify(prev));
13813
+ const found = findGroupAndParent(next, id);
13814
+ if (!found || found.index === found.siblings.length - 1) return prev;
13815
+ const { siblings, index } = found;
13816
+ const item = siblings[index];
13817
+ siblings.splice(index, 1);
13818
+ siblings.splice(index + 1, 0, item);
13819
+ triggerInstantSave(next);
13820
+ return next;
13821
+ });
13822
+ }, [triggerInstantSave]);
13823
+ const handleMentionClick = useCallback5((item) => {
13825
13824
  if (onSelect) onSelect(item);
13826
- };
13825
+ }, [onSelect]);
13826
+ const navigateUp = useCallback5(() => {
13827
+ setNavigationStack((prev) => prev.slice(0, -1));
13828
+ }, []);
13829
+ const navigateTo = useCallback5((folderId) => {
13830
+ setNavigationStack((prev) => [...prev, folderId]);
13831
+ }, []);
13832
+ const navigateToBreadcrumb = useCallback5((index) => {
13833
+ setNavigationStack((prev) => prev.slice(0, index + 1));
13834
+ }, []);
13835
+ const navigateHome = useCallback5(() => {
13836
+ setNavigationStack([]);
13837
+ }, []);
13827
13838
  if (!isOpen) return null;
13828
13839
  return /* @__PURE__ */ React28.createElement(
13829
13840
  "div",
@@ -14355,10 +14366,10 @@ function XViewScene({
14355
14366
  }
14356
14367
  stateRef.current.nodeIdToParentFileMap = map;
14357
14368
  }, [isInitialized, sceneVersion]);
14358
- const handleNavigateBack = useCallback5(() => {
14369
+ const handleNavigateBack = useCallback6(() => {
14359
14370
  router.push("/dashboard/scenes");
14360
14371
  }, [router]);
14361
- const handleConfirmImport = useCallback5(
14372
+ const handleConfirmImport = useCallback6(
14362
14373
  async (importPayload) => {
14363
14374
  var _a2, _b2;
14364
14375
  let files = [];
@@ -14486,7 +14497,7 @@ function XViewScene({
14486
14497
  const handleOpenImageViewer = (images, startIndex) => {
14487
14498
  setImageViewer({ visible: true, images, startIndex });
14488
14499
  };
14489
- const tweenToTarget = useCallback5(
14500
+ const tweenToTarget = useCallback6(
14490
14501
  (target, zoomFactor = 1, forcedDirection = null) => {
14491
14502
  const { camera, controls, tweenGroup } = stateRef.current;
14492
14503
  if (!camera || !controls || !tweenGroup) return;
@@ -14512,7 +14523,7 @@ function XViewScene({
14512
14523
  if (!t || typeof t.closest !== "function") return false;
14513
14524
  return !!t.closest(".ui-overlay");
14514
14525
  };
14515
- const buildFullAncestryTree = useCallback5(
14526
+ const buildFullAncestryTree = useCallback6(
14516
14527
  (idTree, nodes, ancestries = []) => {
14517
14528
  if (!idTree) return null;
14518
14529
  const nodeMap = new Map(nodes.map((n) => [String(n.id), n]));
@@ -14597,7 +14608,7 @@ function XViewScene({
14597
14608
  },
14598
14609
  []
14599
14610
  );
14600
- const handleActivateTimeline = useCallback5(() => {
14611
+ const handleActivateTimeline = useCallback6(() => {
14601
14612
  const { nodeObjects, tweenGroup, timelineIntervalsGroup } = stateRef.current;
14602
14613
  if (!nodeObjects || !tweenGroup || !timelineIntervalsGroup) return;
14603
14614
  while (timelineIntervalsGroup.children.length > 0) {
@@ -14757,7 +14768,7 @@ function XViewScene({
14757
14768
  }
14758
14769
  });
14759
14770
  }, []);
14760
- const handleVersionTimeline = useCallback5((sourceMesh, versionMeshes) => {
14771
+ const handleVersionTimeline = useCallback6((sourceMesh, versionMeshes) => {
14761
14772
  const { tweenGroup, timelineIntervalsGroup } = stateRef.current;
14762
14773
  if (!tweenGroup || !timelineIntervalsGroup || versionMeshes.length === 0)
14763
14774
  return;
@@ -14999,12 +15010,12 @@ function XViewScene({
14999
15010
  focusNodeId,
15000
15011
  focusAncestryId
15001
15012
  ]);
15002
- const isNodeInView = useCallback5((id) => {
15013
+ const isNodeInView = useCallback6((id) => {
15003
15014
  const key = String(id);
15004
15015
  const objs = stateRef.current.nodeObjects || {};
15005
15016
  return !!objs[key];
15006
15017
  }, []);
15007
- const addOrUpdateNodeMesh = useCallback5(
15018
+ const addOrUpdateNodeMesh = useCallback6(
15008
15019
  (nodeData, position, suppressVersionUpdate = false, forceShowQuestDate = false) => {
15009
15020
  const {
15010
15021
  graphGroup,
@@ -15045,7 +15056,7 @@ function XViewScene({
15045
15056
  },
15046
15057
  []
15047
15058
  );
15048
- const handleActivateQuestLens = useCallback5(({ assigneeId, status: status2, milestoneId }) => {
15059
+ const handleActivateQuestLens = useCallback6(({ assigneeId, status: status2, milestoneId }) => {
15049
15060
  var _a2;
15050
15061
  const { nodeObjects, tweenGroup, graphGroup } = stateRef.current;
15051
15062
  if (!nodeObjects || !tweenGroup || !graphGroup) return;
@@ -16015,7 +16026,7 @@ function XViewScene({
16015
16026
  get_scene_view_data,
16016
16027
  save_view_data
16017
16028
  ]);
16018
- const handleGhostNodeImageChange = useCallback5((useImage, imageUrl) => {
16029
+ const handleGhostNodeImageChange = useCallback6((useImage, imageUrl) => {
16019
16030
  const {
16020
16031
  node: ghostNode,
16021
16032
  line: ghostLine,
@@ -16063,7 +16074,7 @@ function XViewScene({
16063
16074
  aura: newGhostNode.getObjectByName("aura")
16064
16075
  };
16065
16076
  }, []);
16066
- const handleGhostNodeIntensityChange = useCallback5((newIntensity) => {
16077
+ const handleGhostNodeIntensityChange = useCallback6((newIntensity) => {
16067
16078
  const { node: ghostNode, aura: ghostAura } = stateRef.current.ghostElements;
16068
16079
  if (!ghostNode) return;
16069
16080
  const adjustedIntensity = newIntensity + MIN_VISIBILITY_INTENSITY;
@@ -16084,7 +16095,7 @@ function XViewScene({
16084
16095
  ghostAura.material.opacity = Math.min(0.8, newIntensity * 0.15);
16085
16096
  }
16086
16097
  }, []);
16087
- const handleDetailNodeIntensityChange = useCallback5(
16098
+ const handleDetailNodeIntensityChange = useCallback6(
16088
16099
  (nodeId, newIntensity) => {
16089
16100
  const mesh = stateRef.current.nodeObjects[String(nodeId)];
16090
16101
  if (!mesh) return;
@@ -16240,7 +16251,7 @@ function XViewScene({
16240
16251
  mountRef.current.style.cursor = "default";
16241
16252
  }
16242
16253
  };
16243
- const handleAncestryTreeUpdate = useCallback5((newTree, extraData = null) => {
16254
+ const handleAncestryTreeUpdate = useCallback6((newTree, extraData = null) => {
16244
16255
  setAncestryMode((prev) => {
16245
16256
  const prevTreeStr = JSON.stringify(prev.tree);
16246
16257
  const newTreeStr = JSON.stringify(newTree);
@@ -16324,7 +16335,7 @@ function XViewScene({
16324
16335
  const handleStartVersioning = (nodeData) => {
16325
16336
  userActionHandlers.handleStartVersioning(actionHandlerContext, nodeData);
16326
16337
  };
16327
- const handleStartQuestQuick = useCallback5((questNode) => {
16338
+ const handleStartQuestQuick = useCallback6((questNode) => {
16328
16339
  var _a2, _b2, _c2;
16329
16340
  if (!questNode || !actionHandlerContext) return;
16330
16341
  const allParentNodes = Object.values(parentDataRef.current).flatMap((fileData) => fileData.nodes || []);
@@ -16359,7 +16370,7 @@ function XViewScene({
16359
16370
  }
16360
16371
  setDetailsNode(updatedNode);
16361
16372
  }, [session, actionHandlerContext]);
16362
- const handleFinishQuestQuick = useCallback5((questNode) => {
16373
+ const handleFinishQuestQuick = useCallback6((questNode) => {
16363
16374
  var _a2, _b2, _c2, _d2;
16364
16375
  if (!questNode || !actionHandlerContext) return;
16365
16376
  const {
@@ -16433,7 +16444,7 @@ function XViewScene({
16433
16444
  setDetailsNode(null);
16434
16445
  }
16435
16446
  }, [session, actionHandlerContext, viewMembers, detailsNode]);
16436
- const handleCancelQuest = useCallback5(() => {
16447
+ const handleCancelQuest = useCallback6(() => {
16437
16448
  const { graphGroup, ghostElements } = stateRef.current;
16438
16449
  if (ghostElements.node && graphGroup) {
16439
16450
  if (ghostElements.node.userData.labelObject) {
@@ -16590,7 +16601,7 @@ function XViewScene({
16590
16601
  }
16591
16602
  userActionHandlers.handleCancelConnection(context);
16592
16603
  };
16593
- const handleClearAncestryVisuals = useCallback5((ancestryId) => {
16604
+ const handleClearAncestryVisuals = useCallback6((ancestryId) => {
16594
16605
  const { renderedAncestries, ancestryGroup } = stateRef.current;
16595
16606
  const renderIndex = renderedAncestries.findIndex(
16596
16607
  (a) => String(a.id) === String(ancestryId)
@@ -16608,7 +16619,7 @@ function XViewScene({
16608
16619
  );
16609
16620
  }
16610
16621
  }, []);
16611
- const handleRenderAncestry = useCallback5(
16622
+ const handleRenderAncestry = useCallback6(
16612
16623
  async (ancestryObject, allowedSectionIds = null, activeSectionIdForFocus = null, baseRotation = 0, forceReprocess = true) => {
16613
16624
  setContextMenu(
16614
16625
  (prev) => prev.visible ? { ...prev, visible: false } : prev
@@ -17102,7 +17113,7 @@ function XViewScene({
17102
17113
  ancestryMode.isActive
17103
17114
  ]
17104
17115
  );
17105
- const handleRenderAbstractionTree = useCallback5(
17116
+ const handleRenderAbstractionTree = useCallback6(
17106
17117
  (ancestryObject, targetNodeId = null) => {
17107
17118
  setContextMenu(
17108
17119
  (prev) => prev.visible ? { ...prev, visible: false } : prev
@@ -17190,7 +17201,7 @@ function XViewScene({
17190
17201
  handleClearAncestryVisuals
17191
17202
  ]
17192
17203
  );
17193
- const handleReadModeBranchNav = useCallback5(
17204
+ const handleReadModeBranchNav = useCallback6(
17194
17205
  (nodeId, action, direction = "right") => {
17195
17206
  const { ancestry, branchStack } = readingMode;
17196
17207
  if (!ancestry || !ancestry.tree) return;
@@ -17368,7 +17379,7 @@ function XViewScene({
17368
17379
  },
17369
17380
  [readingMode, handleRenderAncestry, buildFullAncestryTree, tweenToTarget]
17370
17381
  );
17371
- const handleReadModeHighlight = useCallback5((nodeId) => {
17382
+ const handleReadModeHighlight = useCallback6((nodeId) => {
17372
17383
  if (stateRef.current.highlightedNodeId !== nodeId) {
17373
17384
  stateRef.current.highlightedNodeId = nodeId;
17374
17385
  }
@@ -17491,7 +17502,7 @@ function XViewScene({
17491
17502
  buildFullAncestryTree,
17492
17503
  sceneVersion
17493
17504
  ]);
17494
- const handleStartReadingAncestry = useCallback5(
17505
+ const handleStartReadingAncestry = useCallback6(
17495
17506
  async (ancestryObject, renderMode = "full") => {
17496
17507
  setContextMenu(
17497
17508
  (prev) => prev.visible ? { ...prev, visible: false } : prev
@@ -17534,7 +17545,7 @@ function XViewScene({
17534
17545
  },
17535
17546
  [handleRenderAncestry, handleRenderAbstractionTree]
17536
17547
  );
17537
- const handleReadModeSectionChange = useCallback5(
17548
+ const handleReadModeSectionChange = useCallback6(
17538
17549
  (activeSectionId) => {
17539
17550
  const { ancestry, branchStack } = readingMode;
17540
17551
  if (!ancestry || !readingMode.isActive) return;
@@ -17619,10 +17630,10 @@ function XViewScene({
17619
17630
  ancestryDataRef.current
17620
17631
  ]
17621
17632
  );
17622
- const handleCloseReadMode = useCallback5(() => {
17633
+ const handleCloseReadMode = useCallback6(() => {
17623
17634
  setReadingMode({ isActive: false, ancestry: null, branchStack: [] });
17624
17635
  }, []);
17625
- const handleAncestrySectionChange = useCallback5(
17636
+ const handleAncestrySectionChange = useCallback6(
17626
17637
  (activeSectionId, ancestryOverride = null, rotation = 0) => {
17627
17638
  var _a2, _b2;
17628
17639
  const currentMode = stateRef.current.ancestry;
@@ -17684,7 +17695,7 @@ function XViewScene({
17684
17695
  },
17685
17696
  [handleRenderAncestry]
17686
17697
  );
17687
- const handleEditAncestry = useCallback5(
17698
+ const handleEditAncestry = useCallback6(
17688
17699
  async (ancestryObject) => {
17689
17700
  setContextMenu(
17690
17701
  (prev) => prev.visible ? { ...prev, visible: false } : prev
@@ -17739,7 +17750,7 @@ function XViewScene({
17739
17750
  const handleSelectAncestryParent = (nodeId) => {
17740
17751
  setAncestryMode((prev) => ({ ...prev, selectedParentId: nodeId }));
17741
17752
  };
17742
- const handleRemoveFromAncestry = useCallback5((pathToRemove) => {
17753
+ const handleRemoveFromAncestry = useCallback6((pathToRemove) => {
17743
17754
  if (!Array.isArray(pathToRemove) || pathToRemove.length === 0) {
17744
17755
  console.warn("Tentativa de remover a raiz ou caminho inv\xE1lido.");
17745
17756
  return;
@@ -17764,7 +17775,7 @@ function XViewScene({
17764
17775
  return { ...prev, tree: newTree };
17765
17776
  });
17766
17777
  }, []);
17767
- const handleSaveAncestry = useCallback5(
17778
+ const handleSaveAncestry = useCallback6(
17768
17779
  async (ancestryName, ancestryDescription, ancestrySections, keepOpen = false, treeOverride = null, ancestryCustomProps = {}) => {
17769
17780
  const treeToUse = treeOverride || ancestryMode.tree;
17770
17781
  const { isEditMode, currentAncestryId } = ancestryMode;
@@ -18000,7 +18011,7 @@ function XViewScene({
18000
18011
  });
18001
18012
  setEditingAncestryRel({ visible: false, data: null, path: null });
18002
18013
  };
18003
- const handleDeleteAncestry = useCallback5(
18014
+ const handleDeleteAncestry = useCallback6(
18004
18015
  async (ancestryIdToDelete) => {
18005
18016
  if (!ancestryIdToDelete) {
18006
18017
  alert("ID da ancestralidade n\xE3o encontrado.");
@@ -18082,7 +18093,7 @@ function XViewScene({
18082
18093
  },
18083
18094
  [save_view_data, delete_file_action]
18084
18095
  );
18085
- const handleOpenBoards = useCallback5(() => {
18096
+ const handleOpenBoards = useCallback6(() => {
18086
18097
  setIsBoardsOpen(true);
18087
18098
  }, []);
18088
18099
  const allAvailableNodes = useMemo13(() => {
@@ -18094,7 +18105,23 @@ function XViewScene({
18094
18105
  const allAvailableAncestries = useMemo13(() => {
18095
18106
  return ancestryDataRef.current || [];
18096
18107
  }, [sceneVersion, isInitialized]);
18097
- const handleOpenReference = useCallback5(
18108
+ const handleFocusNode = useCallback6(
18109
+ (nodeData) => {
18110
+ var _a2;
18111
+ if (!nodeData) return;
18112
+ let nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18113
+ if (!nodeMesh) {
18114
+ const spawnPos = ((_a2 = stateRef.current.controls) == null ? void 0 : _a2.target.clone()) || new THREE3.Vector3();
18115
+ addStandaloneNodeToScene(stateRef.current, nodeData, spawnPos);
18116
+ nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18117
+ }
18118
+ if (nodeMesh) {
18119
+ tweenToTarget(nodeMesh, 1.2);
18120
+ }
18121
+ },
18122
+ [tweenToTarget]
18123
+ );
18124
+ const handleOpenReference = useCallback6(
18098
18125
  (referenceData) => {
18099
18126
  const { type, id } = referenceData;
18100
18127
  if (type === "node") {
@@ -18105,10 +18132,7 @@ function XViewScene({
18105
18132
  setAncestryLinkDetails(null);
18106
18133
  setDetailsLink(null);
18107
18134
  setDetailsNode(targetNode);
18108
- const sceneMesh = stateRef.current.nodeObjects[String(id)];
18109
- if (sceneMesh) {
18110
- tweenToTarget(sceneMesh);
18111
- }
18135
+ handleFocusNode(targetNode);
18112
18136
  } else {
18113
18137
  alert("Node original n\xE3o encontrado neste contexto.");
18114
18138
  }
@@ -18130,10 +18154,10 @@ function XViewScene({
18130
18154
  allAvailableNodes,
18131
18155
  allAvailableAncestries,
18132
18156
  handleEditAncestry,
18133
- tweenToTarget
18157
+ handleFocusNode
18134
18158
  ]
18135
18159
  );
18136
- const handleSelectAncestryFromBoard = useCallback5(
18160
+ const handleSelectAncestryFromBoard = useCallback6(
18137
18161
  (item) => {
18138
18162
  setIsBoardsOpen(false);
18139
18163
  setIsSidebarOpen(false);
@@ -18145,7 +18169,7 @@ function XViewScene({
18145
18169
  },
18146
18170
  [handleStartReadingAncestry, handleOpenReference]
18147
18171
  );
18148
- const handleSaveBoards = useCallback5(
18172
+ const handleSaveBoards = useCallback6(
18149
18173
  async (boardItems2) => {
18150
18174
  if (!sceneConfigId || !viewParams || !session) return;
18151
18175
  const sceneType = (viewParams.type || "").toLowerCase().includes("database") ? "database" : "view";
@@ -18186,7 +18210,7 @@ function XViewScene({
18186
18210
  return !((_a2 = node.version_node) == null ? void 0 : _a2.is_version);
18187
18211
  });
18188
18212
  }, [parentDataRef.current, sceneVersion]);
18189
- const handleAddExistingNode = useCallback5(
18213
+ const handleAddExistingNode = useCallback6(
18190
18214
  (nodeId) => {
18191
18215
  return userActionHandlers.handleAddExistingNodeById(
18192
18216
  actionHandlerContext,
@@ -18195,7 +18219,7 @@ function XViewScene({
18195
18219
  },
18196
18220
  [actionHandlerContext]
18197
18221
  );
18198
- const handleUpdateMilestones = useCallback5(
18222
+ const handleUpdateMilestones = useCallback6(
18199
18223
  async (newMilestones) => {
18200
18224
  var _a2, _b2, _c2;
18201
18225
  if (!sceneDataRef.current) return;
@@ -18241,7 +18265,7 @@ function XViewScene({
18241
18265
  viewParams == null ? void 0 : viewParams.type
18242
18266
  ]
18243
18267
  );
18244
- const handleSaveCurrentView = useCallback5(async () => {
18268
+ const handleSaveCurrentView = useCallback6(async () => {
18245
18269
  var _a2, _b2, _c2;
18246
18270
  const { nodeObjects, allLinks } = stateRef.current;
18247
18271
  if (!nodeObjects || !allLinks || !sceneSaveUrl || !parentDataRef.current) {
@@ -18284,28 +18308,12 @@ function XViewScene({
18284
18308
  console.error("Erro na chamada de save_view_data:", error);
18285
18309
  }
18286
18310
  }, [sceneSaveUrl, save_view_data, sceneConfigId, viewParams == null ? void 0 : viewParams.type]);
18287
- const handleToggleAncestryAddMode = useCallback5(() => {
18311
+ const handleToggleAncestryAddMode = useCallback6(() => {
18288
18312
  setAncestryMode((prev) => ({
18289
18313
  ...prev,
18290
18314
  isAddingNodes: !prev.isAddingNodes
18291
18315
  }));
18292
18316
  }, []);
18293
- const handleFocusNode = useCallback5(
18294
- (nodeData) => {
18295
- var _a2;
18296
- if (!nodeData) return;
18297
- let nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18298
- if (!nodeMesh) {
18299
- const spawnPos = ((_a2 = stateRef.current.controls) == null ? void 0 : _a2.target.clone()) || new THREE3.Vector3();
18300
- addStandaloneNodeToScene(stateRef.current, nodeData, spawnPos);
18301
- nodeMesh = stateRef.current.nodeObjects[String(nodeData.id)];
18302
- }
18303
- if (nodeMesh) {
18304
- tweenToTarget(nodeMesh, 1.2);
18305
- }
18306
- },
18307
- [tweenToTarget]
18308
- );
18309
18317
  const availableDatasets = useMemo13(() => {
18310
18318
  if (!sceneDataRef.current || !parentDataRef.current) return [];
18311
18319
  return sceneDataRef.current.parent_dbs.map((db) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.6-dev.30",
3
+ "version": "1.2.6-dev.32",
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",