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

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
@@ -5530,6 +5530,7 @@ function CreateAncestryPanel({
5530
5530
  } = ancestryMode;
5531
5531
  const [isSaving, setIsSaving] = (0, import_react11.useState)(false);
5532
5532
  const [isLinkCopied, setIsLinkCopied] = (0, import_react11.useState)(false);
5533
+ const [showDeleteBranchConfirm, setShowDeleteBranchConfirm] = (0, import_react11.useState)(false);
5533
5534
  const handleCopyLink = (e) => {
5534
5535
  e.stopPropagation();
5535
5536
  if (!currentAncestryId || currentAncestryId === "temp_root" || currentAncestryId === "temp_creating") {
@@ -5547,6 +5548,9 @@ function CreateAncestryPanel({
5547
5548
  const [customProps, setCustomProps] = (0, import_react11.useState)([]);
5548
5549
  const propsEndRef = (0, import_react11.useRef)(null);
5549
5550
  const [branchStack, setBranchStack] = (0, import_react11.useState)([]);
5551
+ (0, import_react11.useEffect)(() => {
5552
+ setShowDeleteBranchConfirm(false);
5553
+ }, [branchStack]);
5550
5554
  const [targetRenderNodeId, setTargetRenderNodeId] = (0, import_react11.useState)(null);
5551
5555
  const highlightedPathIds = (0, import_react11.useMemo)(() => {
5552
5556
  var _a, _b;
@@ -5957,6 +5961,59 @@ function CreateAncestryPanel({
5957
5961
  }
5958
5962
  }
5959
5963
  };
5964
+ const handleDeleteBranch = async () => {
5965
+ if (branchStack.length === 0) return;
5966
+ const rootTreeClone = JSON.parse(JSON.stringify(ancestryMode.tree));
5967
+ let ptr = rootTreeClone;
5968
+ for (let i = 0; i < branchStack.length - 1; i++) {
5969
+ const step = branchStack[i];
5970
+ const found = findNodePath2(ptr, step.nodeId);
5971
+ if (found && found.node.parallel_branches) {
5972
+ const branch = found.node.parallel_branches.find((b) => b.id === step.branchId);
5973
+ if (branch) ptr = branch.tree;
5974
+ }
5975
+ }
5976
+ const currentStep = branchStack[branchStack.length - 1];
5977
+ const foundParentPath = findNodePath2(ptr, currentStep.nodeId);
5978
+ if (foundParentPath && foundParentPath.node && foundParentPath.node.parallel_branches) {
5979
+ const branchIndex = foundParentPath.node.parallel_branches.findIndex((b) => b.id === currentStep.branchId);
5980
+ if (branchIndex !== -1) {
5981
+ foundParentPath.node.parallel_branches.splice(branchIndex, 1);
5982
+ updateGlobalTree(rootTreeClone);
5983
+ try {
5984
+ setIsSaving(true);
5985
+ const currentRootProps = extractCustomPropsFromNode(ancestryMode);
5986
+ const rootExtras = toObjectFromCustomProps(currentRootProps);
5987
+ await onSave(
5988
+ ancestryMode.ancestryName,
5989
+ ancestryMode.ancestryDescription,
5990
+ ancestryMode.ancestryDescriptionSections,
5991
+ true,
5992
+ rootTreeClone,
5993
+ rootExtras
5994
+ );
5995
+ setLastSavedSnapshot(takeSnapshot(
5996
+ rootTreeClone,
5997
+ ancestryMode.ancestryName,
5998
+ ancestryMode.ancestryDescription,
5999
+ ancestryMode.ancestryDescriptionSections,
6000
+ currentRootProps,
6001
+ isPrivate,
6002
+ ancestryMode.abstraction_tree
6003
+ ));
6004
+ if (onClearAncestryVisuals) {
6005
+ onClearAncestryVisuals(currentStep.branchId);
6006
+ }
6007
+ handleNavigateUp();
6008
+ } catch (err) {
6009
+ console.error("Erro ao remover a ramifica\xE7\xE3o:", err);
6010
+ alert("Erro ao remover a ramifica\xE7\xE3o.");
6011
+ } finally {
6012
+ setIsSaving(false);
6013
+ }
6014
+ }
6015
+ }
6016
+ };
5960
6017
  const sideActions = (0, import_react11.useMemo)(() => {
5961
6018
  const actions = { left: null, right: null };
5962
6019
  const isInBranch = branchStack.length > 0;
@@ -6619,7 +6676,7 @@ function CreateAncestryPanel({
6619
6676
  placeholder: "Nome da Ancestralidade",
6620
6677
  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
6678
  }
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(
6679
+ )), /* @__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
6680
  "button",
6624
6681
  {
6625
6682
  onClick: handleNavigateUp,
@@ -6627,7 +6684,33 @@ function CreateAncestryPanel({
6627
6684
  },
6628
6685
  /* @__PURE__ */ import_react11.default.createElement(import_fi9.FiArrowLeft, null),
6629
6686
  " Voltar para Principal / N\xEDvel Anterior"
6630
- )), /* @__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(
6687
+ ), !isContextLinked && /* @__PURE__ */ import_react11.default.createElement("div", { className: "relative animate-in fade-in duration-200" }, showDeleteBranchConfirm ? /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-3 bg-rose-500/10 border border-rose-500/30 px-3 py-1 rounded-md shadow-inner" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "text-xs text-rose-300 font-medium" }, "Excluir?"), /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react11.default.createElement(
6688
+ "button",
6689
+ {
6690
+ onClick: () => {
6691
+ setShowDeleteBranchConfirm(false);
6692
+ handleDeleteBranch();
6693
+ },
6694
+ className: "text-xs font-bold text-rose-400 hover:text-rose-200 transition-colors"
6695
+ },
6696
+ "Sim"
6697
+ ), /* @__PURE__ */ import_react11.default.createElement("span", { className: "text-slate-600/50" }, "|"), /* @__PURE__ */ import_react11.default.createElement(
6698
+ "button",
6699
+ {
6700
+ onClick: () => setShowDeleteBranchConfirm(false),
6701
+ className: "text-xs text-slate-400 hover:text-white transition-colors"
6702
+ },
6703
+ "N\xE3o"
6704
+ ))) : /* @__PURE__ */ import_react11.default.createElement(
6705
+ "button",
6706
+ {
6707
+ onClick: () => setShowDeleteBranchConfirm(true),
6708
+ className: "flex items-center gap-1.5 text-xs text-rose-400/80 hover:text-white hover:bg-rose-500/20 px-2 py-1 rounded transition-colors",
6709
+ title: "Excluir permanentemente esta ramifica\xE7\xE3o e seu conte\xFAdo"
6710
+ },
6711
+ /* @__PURE__ */ import_react11.default.createElement(import_fi9.FiTrash2, null),
6712
+ " Excluir Ramifica\xE7\xE3o"
6713
+ ))), /* @__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
6714
  "button",
6632
6715
  {
6633
6716
  onClick: handleUnlinkAncestry,
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
@@ -5516,6 +5517,7 @@ function CreateAncestryPanel({
5516
5517
  } = ancestryMode;
5517
5518
  const [isSaving, setIsSaving] = useState11(false);
5518
5519
  const [isLinkCopied, setIsLinkCopied] = useState11(false);
5520
+ const [showDeleteBranchConfirm, setShowDeleteBranchConfirm] = useState11(false);
5519
5521
  const handleCopyLink = (e) => {
5520
5522
  e.stopPropagation();
5521
5523
  if (!currentAncestryId || currentAncestryId === "temp_root" || currentAncestryId === "temp_creating") {
@@ -5533,6 +5535,9 @@ function CreateAncestryPanel({
5533
5535
  const [customProps, setCustomProps] = useState11([]);
5534
5536
  const propsEndRef = useRef8(null);
5535
5537
  const [branchStack, setBranchStack] = useState11([]);
5538
+ useEffect10(() => {
5539
+ setShowDeleteBranchConfirm(false);
5540
+ }, [branchStack]);
5536
5541
  const [targetRenderNodeId, setTargetRenderNodeId] = useState11(null);
5537
5542
  const highlightedPathIds = useMemo8(() => {
5538
5543
  var _a, _b;
@@ -5943,6 +5948,59 @@ function CreateAncestryPanel({
5943
5948
  }
5944
5949
  }
5945
5950
  };
5951
+ const handleDeleteBranch = async () => {
5952
+ if (branchStack.length === 0) return;
5953
+ const rootTreeClone = JSON.parse(JSON.stringify(ancestryMode.tree));
5954
+ let ptr = rootTreeClone;
5955
+ for (let i = 0; i < branchStack.length - 1; i++) {
5956
+ const step = branchStack[i];
5957
+ const found = findNodePath2(ptr, step.nodeId);
5958
+ if (found && found.node.parallel_branches) {
5959
+ const branch = found.node.parallel_branches.find((b) => b.id === step.branchId);
5960
+ if (branch) ptr = branch.tree;
5961
+ }
5962
+ }
5963
+ const currentStep = branchStack[branchStack.length - 1];
5964
+ const foundParentPath = findNodePath2(ptr, currentStep.nodeId);
5965
+ if (foundParentPath && foundParentPath.node && foundParentPath.node.parallel_branches) {
5966
+ const branchIndex = foundParentPath.node.parallel_branches.findIndex((b) => b.id === currentStep.branchId);
5967
+ if (branchIndex !== -1) {
5968
+ foundParentPath.node.parallel_branches.splice(branchIndex, 1);
5969
+ updateGlobalTree(rootTreeClone);
5970
+ try {
5971
+ setIsSaving(true);
5972
+ const currentRootProps = extractCustomPropsFromNode(ancestryMode);
5973
+ const rootExtras = toObjectFromCustomProps(currentRootProps);
5974
+ await onSave(
5975
+ ancestryMode.ancestryName,
5976
+ ancestryMode.ancestryDescription,
5977
+ ancestryMode.ancestryDescriptionSections,
5978
+ true,
5979
+ rootTreeClone,
5980
+ rootExtras
5981
+ );
5982
+ setLastSavedSnapshot(takeSnapshot(
5983
+ rootTreeClone,
5984
+ ancestryMode.ancestryName,
5985
+ ancestryMode.ancestryDescription,
5986
+ ancestryMode.ancestryDescriptionSections,
5987
+ currentRootProps,
5988
+ isPrivate,
5989
+ ancestryMode.abstraction_tree
5990
+ ));
5991
+ if (onClearAncestryVisuals) {
5992
+ onClearAncestryVisuals(currentStep.branchId);
5993
+ }
5994
+ handleNavigateUp();
5995
+ } catch (err) {
5996
+ console.error("Erro ao remover a ramifica\xE7\xE3o:", err);
5997
+ alert("Erro ao remover a ramifica\xE7\xE3o.");
5998
+ } finally {
5999
+ setIsSaving(false);
6000
+ }
6001
+ }
6002
+ }
6003
+ };
5946
6004
  const sideActions = useMemo8(() => {
5947
6005
  const actions = { left: null, right: null };
5948
6006
  const isInBranch = branchStack.length > 0;
@@ -6605,7 +6663,7 @@ function CreateAncestryPanel({
6605
6663
  placeholder: "Nome da Ancestralidade",
6606
6664
  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
6665
  }
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(
6666
+ )), /* @__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
6667
  "button",
6610
6668
  {
6611
6669
  onClick: handleNavigateUp,
@@ -6613,7 +6671,33 @@ function CreateAncestryPanel({
6613
6671
  },
6614
6672
  /* @__PURE__ */ React10.createElement(FiArrowLeft2, null),
6615
6673
  " Voltar para Principal / N\xEDvel Anterior"
6616
- )), /* @__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(
6674
+ ), !isContextLinked && /* @__PURE__ */ React10.createElement("div", { className: "relative animate-in fade-in duration-200" }, showDeleteBranchConfirm ? /* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-3 bg-rose-500/10 border border-rose-500/30 px-3 py-1 rounded-md shadow-inner" }, /* @__PURE__ */ React10.createElement("span", { className: "text-xs text-rose-300 font-medium" }, "Excluir?"), /* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React10.createElement(
6675
+ "button",
6676
+ {
6677
+ onClick: () => {
6678
+ setShowDeleteBranchConfirm(false);
6679
+ handleDeleteBranch();
6680
+ },
6681
+ className: "text-xs font-bold text-rose-400 hover:text-rose-200 transition-colors"
6682
+ },
6683
+ "Sim"
6684
+ ), /* @__PURE__ */ React10.createElement("span", { className: "text-slate-600/50" }, "|"), /* @__PURE__ */ React10.createElement(
6685
+ "button",
6686
+ {
6687
+ onClick: () => setShowDeleteBranchConfirm(false),
6688
+ className: "text-xs text-slate-400 hover:text-white transition-colors"
6689
+ },
6690
+ "N\xE3o"
6691
+ ))) : /* @__PURE__ */ React10.createElement(
6692
+ "button",
6693
+ {
6694
+ onClick: () => setShowDeleteBranchConfirm(true),
6695
+ className: "flex items-center gap-1.5 text-xs text-rose-400/80 hover:text-white hover:bg-rose-500/20 px-2 py-1 rounded transition-colors",
6696
+ title: "Excluir permanentemente esta ramifica\xE7\xE3o e seu conte\xFAdo"
6697
+ },
6698
+ /* @__PURE__ */ React10.createElement(FiTrash22, null),
6699
+ " Excluir Ramifica\xE7\xE3o"
6700
+ ))), /* @__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
6701
  "button",
6618
6702
  {
6619
6703
  onClick: handleUnlinkAncestry,
@@ -8949,7 +9033,7 @@ import {
8949
9033
  FiCornerUpRight as FiCornerUpRight4,
8950
9034
  FiPlay,
8951
9035
  FiPlus as FiPlus7,
8952
- FiTrash2 as FiTrash22,
9036
+ FiTrash2 as FiTrash23,
8953
9037
  FiArrowLeft as FiArrowLeft3,
8954
9038
  FiArrowRight,
8955
9039
  FiCheckCircle,
@@ -9086,7 +9170,7 @@ var GroupItem = ({
9086
9170
  className: "p-1.5 text-slate-600 hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",
9087
9171
  title: "Remover Grupo"
9088
9172
  },
9089
- /* @__PURE__ */ React22.createElement(FiTrash22, { size: 14 })
9173
+ /* @__PURE__ */ React22.createElement(FiTrash23, { size: 14 })
9090
9174
  )))), group.children && group.children.length > 0 && /* @__PURE__ */ React22.createElement("div", { className: "ml-2" }, group.children.map((childGroup, idx) => /* @__PURE__ */ React22.createElement(
9091
9175
  GroupItem,
9092
9176
  {
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.27",
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",