@lv-x-software-house/x_view 1.2.2-dev.24 → 1.2.2-dev.26

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
@@ -5957,6 +5957,62 @@ function CreateAncestryPanel({
5957
5957
  }
5958
5958
  }
5959
5959
  };
5960
+ const handleDeleteBranch = async () => {
5961
+ if (branchStack.length === 0) return;
5962
+ const confirmDelete = window.confirm("Tem certeza que deseja excluir esta ramifica\xE7\xE3o e todo o seu conte\xFAdo interno?");
5963
+ if (!confirmDelete) return;
5964
+ const rootTreeClone = JSON.parse(JSON.stringify(ancestryMode.tree));
5965
+ let ptr = rootTreeClone;
5966
+ for (let i = 0; i < branchStack.length - 1; i++) {
5967
+ const step = branchStack[i];
5968
+ const found = findNodePath2(ptr, step.nodeId);
5969
+ if (found && found.node.parallel_branches) {
5970
+ const branch = found.node.parallel_branches.find((b) => b.id === step.branchId);
5971
+ if (branch) ptr = branch.tree;
5972
+ }
5973
+ }
5974
+ const currentStep = branchStack[branchStack.length - 1];
5975
+ const foundParentPath = findNodePath2(ptr, currentStep.nodeId);
5976
+ if (foundParentPath && foundParentPath.node && foundParentPath.node.parallel_branches) {
5977
+ const branchIndex = foundParentPath.node.parallel_branches.findIndex((b) => b.id === currentStep.branchId);
5978
+ if (branchIndex !== -1) {
5979
+ foundParentPath.node.parallel_branches.splice(branchIndex, 1);
5980
+ updateGlobalTree(rootTreeClone);
5981
+ try {
5982
+ setIsSaving(true);
5983
+ const currentRootProps = extractCustomPropsFromNode(ancestryMode);
5984
+ const rootExtras = toObjectFromCustomProps(currentRootProps);
5985
+ await onSave(
5986
+ ancestryMode.ancestryName,
5987
+ ancestryMode.ancestryDescription,
5988
+ ancestryMode.ancestryDescriptionSections,
5989
+ true,
5990
+ // keepOpen
5991
+ rootTreeClone,
5992
+ rootExtras
5993
+ );
5994
+ setLastSavedSnapshot(takeSnapshot(
5995
+ rootTreeClone,
5996
+ ancestryMode.ancestryName,
5997
+ ancestryMode.ancestryDescription,
5998
+ ancestryMode.ancestryDescriptionSections,
5999
+ currentRootProps,
6000
+ isPrivate,
6001
+ ancestryMode.abstraction_tree
6002
+ ));
6003
+ if (onClearAncestryVisuals) {
6004
+ onClearAncestryVisuals(currentStep.branchId);
6005
+ }
6006
+ handleNavigateUp();
6007
+ } catch (err) {
6008
+ console.error("Erro ao remover a ramifica\xE7\xE3o:", err);
6009
+ alert("Erro ao remover a ramifica\xE7\xE3o.");
6010
+ } finally {
6011
+ setIsSaving(false);
6012
+ }
6013
+ }
6014
+ }
6015
+ };
5960
6016
  const sideActions = (0, import_react11.useMemo)(() => {
5961
6017
  const actions = { left: null, right: null };
5962
6018
  const isInBranch = branchStack.length > 0;
@@ -6619,7 +6675,7 @@ function CreateAncestryPanel({
6619
6675
  placeholder: "Nome da Ancestralidade",
6620
6676
  className: "text-xl sm:text-2xl font-semibold tracking-tight bg-transparent border-none p-0 focus:ring-2 focus:ring-indigo-500 rounded-md -ml-1.5 px-1.5 w-full outline-none transition-all focus:bg-slate-800/70"
6621
6677
  }
6622
- )), /* @__PURE__ */ import_react11.default.createElement("button", { onClick: onClose, className: "w-9 h-9 grid place-content-center rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-xl flex-shrink-0", title: "Cancelar" }, "\xD7")), branchStack.length > 0 && /* @__PURE__ */ import_react11.default.createElement("div", { className: "px-6 pb-2" }, /* @__PURE__ */ import_react11.default.createElement(
6678
+ )), /* @__PURE__ */ import_react11.default.createElement("button", { onClick: onClose, className: "w-9 h-9 grid place-content-center rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-xl flex-shrink-0", title: "Cancelar" }, "\xD7")), branchStack.length > 0 && /* @__PURE__ */ import_react11.default.createElement("div", { className: "px-6 pb-2 flex items-center justify-between" }, /* @__PURE__ */ import_react11.default.createElement(
6623
6679
  "button",
6624
6680
  {
6625
6681
  onClick: handleNavigateUp,
@@ -6627,6 +6683,15 @@ function CreateAncestryPanel({
6627
6683
  },
6628
6684
  /* @__PURE__ */ import_react11.default.createElement(import_fi9.FiArrowLeft, null),
6629
6685
  " Voltar para Principal / N\xEDvel Anterior"
6686
+ ), !isContextLinked && /* @__PURE__ */ import_react11.default.createElement(
6687
+ "button",
6688
+ {
6689
+ onClick: handleDeleteBranch,
6690
+ className: "flex items-center gap-1.5 text-xs text-rose-400 hover:text-white hover:bg-rose-500/20 px-2 py-1 rounded transition-colors",
6691
+ title: "Excluir permanentemente esta ramifica\xE7\xE3o e seu conte\xFAdo"
6692
+ },
6693
+ /* @__PURE__ */ import_react11.default.createElement(import_fi9.FiTrash2, null),
6694
+ " Excluir Ramifica\xE7\xE3o"
6630
6695
  )), /* @__PURE__ */ import_react11.default.createElement("div", { className: "px-6 pb-4 pt-2 overflow-y-auto flex-grow custom-scrollbar" }, branchStack.length > 0 && /* @__PURE__ */ import_react11.default.createElement("div", { className: "mb-4" }, isContextLinked ? /* @__PURE__ */ import_react11.default.createElement("div", { className: "p-3 rounded-lg bg-indigo-500/10 border border-indigo-500/30 flex items-center justify-between" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "w-8 h-8 rounded bg-indigo-500/20 text-indigo-300 grid place-content-center" }, /* @__PURE__ */ import_react11.default.createElement(import_fi9.FiLayers, null)), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("div", { className: "text-xs text-indigo-200 font-semibold uppercase tracking-wider" }, "Ancestralidade Vinculada"), /* @__PURE__ */ import_react11.default.createElement("div", { className: "text-sm text-white font-medium truncate max-w-[200px]" }, currentContext.name.replace("[REF] ", "")))), /* @__PURE__ */ import_react11.default.createElement(
6631
6696
  "button",
6632
6697
  {
package/dist/index.mjs CHANGED
@@ -5279,7 +5279,8 @@ import {
5279
5279
  FiGitBranch as FiGitBranch2,
5280
5280
  FiPlus as FiPlus2,
5281
5281
  FiLock,
5282
- FiLink as FiLink4
5282
+ FiLink as FiLink4,
5283
+ FiTrash2 as FiTrash22
5283
5284
  } from "react-icons/fi";
5284
5285
 
5285
5286
  // src/components/AncestryPickerModal.jsx
@@ -5943,6 +5944,62 @@ function CreateAncestryPanel({
5943
5944
  }
5944
5945
  }
5945
5946
  };
5947
+ const handleDeleteBranch = async () => {
5948
+ if (branchStack.length === 0) return;
5949
+ const confirmDelete = window.confirm("Tem certeza que deseja excluir esta ramifica\xE7\xE3o e todo o seu conte\xFAdo interno?");
5950
+ if (!confirmDelete) return;
5951
+ const rootTreeClone = JSON.parse(JSON.stringify(ancestryMode.tree));
5952
+ let ptr = rootTreeClone;
5953
+ for (let i = 0; i < branchStack.length - 1; i++) {
5954
+ const step = branchStack[i];
5955
+ const found = findNodePath2(ptr, step.nodeId);
5956
+ if (found && found.node.parallel_branches) {
5957
+ const branch = found.node.parallel_branches.find((b) => b.id === step.branchId);
5958
+ if (branch) ptr = branch.tree;
5959
+ }
5960
+ }
5961
+ const currentStep = branchStack[branchStack.length - 1];
5962
+ const foundParentPath = findNodePath2(ptr, currentStep.nodeId);
5963
+ if (foundParentPath && foundParentPath.node && foundParentPath.node.parallel_branches) {
5964
+ const branchIndex = foundParentPath.node.parallel_branches.findIndex((b) => b.id === currentStep.branchId);
5965
+ if (branchIndex !== -1) {
5966
+ foundParentPath.node.parallel_branches.splice(branchIndex, 1);
5967
+ updateGlobalTree(rootTreeClone);
5968
+ try {
5969
+ setIsSaving(true);
5970
+ const currentRootProps = extractCustomPropsFromNode(ancestryMode);
5971
+ const rootExtras = toObjectFromCustomProps(currentRootProps);
5972
+ await onSave(
5973
+ ancestryMode.ancestryName,
5974
+ ancestryMode.ancestryDescription,
5975
+ ancestryMode.ancestryDescriptionSections,
5976
+ true,
5977
+ // keepOpen
5978
+ rootTreeClone,
5979
+ rootExtras
5980
+ );
5981
+ setLastSavedSnapshot(takeSnapshot(
5982
+ rootTreeClone,
5983
+ ancestryMode.ancestryName,
5984
+ ancestryMode.ancestryDescription,
5985
+ ancestryMode.ancestryDescriptionSections,
5986
+ currentRootProps,
5987
+ isPrivate,
5988
+ ancestryMode.abstraction_tree
5989
+ ));
5990
+ if (onClearAncestryVisuals) {
5991
+ onClearAncestryVisuals(currentStep.branchId);
5992
+ }
5993
+ handleNavigateUp();
5994
+ } catch (err) {
5995
+ console.error("Erro ao remover a ramifica\xE7\xE3o:", err);
5996
+ alert("Erro ao remover a ramifica\xE7\xE3o.");
5997
+ } finally {
5998
+ setIsSaving(false);
5999
+ }
6000
+ }
6001
+ }
6002
+ };
5946
6003
  const sideActions = useMemo8(() => {
5947
6004
  const actions = { left: null, right: null };
5948
6005
  const isInBranch = branchStack.length > 0;
@@ -6605,7 +6662,7 @@ function CreateAncestryPanel({
6605
6662
  placeholder: "Nome da Ancestralidade",
6606
6663
  className: "text-xl sm:text-2xl font-semibold tracking-tight bg-transparent border-none p-0 focus:ring-2 focus:ring-indigo-500 rounded-md -ml-1.5 px-1.5 w-full outline-none transition-all focus:bg-slate-800/70"
6607
6664
  }
6608
- )), /* @__PURE__ */ React10.createElement("button", { onClick: onClose, className: "w-9 h-9 grid place-content-center rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-xl flex-shrink-0", title: "Cancelar" }, "\xD7")), branchStack.length > 0 && /* @__PURE__ */ React10.createElement("div", { className: "px-6 pb-2" }, /* @__PURE__ */ React10.createElement(
6665
+ )), /* @__PURE__ */ React10.createElement("button", { onClick: onClose, className: "w-9 h-9 grid place-content-center rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-xl flex-shrink-0", title: "Cancelar" }, "\xD7")), branchStack.length > 0 && /* @__PURE__ */ React10.createElement("div", { className: "px-6 pb-2 flex items-center justify-between" }, /* @__PURE__ */ React10.createElement(
6609
6666
  "button",
6610
6667
  {
6611
6668
  onClick: handleNavigateUp,
@@ -6613,6 +6670,15 @@ function CreateAncestryPanel({
6613
6670
  },
6614
6671
  /* @__PURE__ */ React10.createElement(FiArrowLeft2, null),
6615
6672
  " Voltar para Principal / N\xEDvel Anterior"
6673
+ ), !isContextLinked && /* @__PURE__ */ React10.createElement(
6674
+ "button",
6675
+ {
6676
+ onClick: handleDeleteBranch,
6677
+ className: "flex items-center gap-1.5 text-xs text-rose-400 hover:text-white hover:bg-rose-500/20 px-2 py-1 rounded transition-colors",
6678
+ title: "Excluir permanentemente esta ramifica\xE7\xE3o e seu conte\xFAdo"
6679
+ },
6680
+ /* @__PURE__ */ React10.createElement(FiTrash22, null),
6681
+ " Excluir Ramifica\xE7\xE3o"
6616
6682
  )), /* @__PURE__ */ React10.createElement("div", { className: "px-6 pb-4 pt-2 overflow-y-auto flex-grow custom-scrollbar" }, branchStack.length > 0 && /* @__PURE__ */ React10.createElement("div", { className: "mb-4" }, isContextLinked ? /* @__PURE__ */ React10.createElement("div", { className: "p-3 rounded-lg bg-indigo-500/10 border border-indigo-500/30 flex items-center justify-between" }, /* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React10.createElement("div", { className: "w-8 h-8 rounded bg-indigo-500/20 text-indigo-300 grid place-content-center" }, /* @__PURE__ */ React10.createElement(FiLayers5, null)), /* @__PURE__ */ React10.createElement("div", null, /* @__PURE__ */ React10.createElement("div", { className: "text-xs text-indigo-200 font-semibold uppercase tracking-wider" }, "Ancestralidade Vinculada"), /* @__PURE__ */ React10.createElement("div", { className: "text-sm text-white font-medium truncate max-w-[200px]" }, currentContext.name.replace("[REF] ", "")))), /* @__PURE__ */ React10.createElement(
6617
6683
  "button",
6618
6684
  {
@@ -8949,7 +9015,7 @@ import {
8949
9015
  FiCornerUpRight as FiCornerUpRight4,
8950
9016
  FiPlay,
8951
9017
  FiPlus as FiPlus7,
8952
- FiTrash2 as FiTrash22,
9018
+ FiTrash2 as FiTrash23,
8953
9019
  FiArrowLeft as FiArrowLeft3,
8954
9020
  FiArrowRight,
8955
9021
  FiCheckCircle,
@@ -9086,7 +9152,7 @@ var GroupItem = ({
9086
9152
  className: "p-1.5 text-slate-600 hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",
9087
9153
  title: "Remover Grupo"
9088
9154
  },
9089
- /* @__PURE__ */ React22.createElement(FiTrash22, { size: 14 })
9155
+ /* @__PURE__ */ React22.createElement(FiTrash23, { size: 14 })
9090
9156
  )))), group.children && group.children.length > 0 && /* @__PURE__ */ React22.createElement("div", { className: "ml-2" }, group.children.map((childGroup, idx) => /* @__PURE__ */ React22.createElement(
9091
9157
  GroupItem,
9092
9158
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.2-dev.24",
3
+ "version": "1.2.2-dev.26",
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",