@dxos/plugin-navtree 0.8.4-main.c85a9c8dae → 0.8.4-main.d05673bc65

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 (77) hide show
  1. package/dist/lib/browser/{CommandsDialogContent-A27AKTHH.mjs → CommandsDialogContent-2DKIOLJL.mjs} +11 -9
  2. package/dist/lib/browser/CommandsDialogContent-2DKIOLJL.mjs.map +7 -0
  3. package/dist/lib/browser/{CommandsTrigger-HBZYQCGV.mjs → CommandsTrigger-ABODVVMP.mjs} +2 -2
  4. package/dist/lib/browser/NavTreeContainer-TLSYS4KK.mjs +12 -0
  5. package/dist/lib/browser/NavTreeContainer-TLSYS4KK.mjs.map +7 -0
  6. package/dist/lib/browser/{NavTreeDocumentTitle-GEE3URWH.mjs → NavTreeDocumentTitle-L6NLLWLD.mjs} +2 -2
  7. package/dist/lib/browser/{app-graph-builder-XGA4GPGL.mjs → app-graph-builder-Z43OTNI2.mjs} +2 -2
  8. package/dist/lib/browser/{chunk-YKTYPINZ.mjs → chunk-A4VDCIJC.mjs} +3 -3
  9. package/dist/lib/browser/{chunk-YKTYPINZ.mjs.map → chunk-A4VDCIJC.mjs.map} +1 -1
  10. package/dist/lib/browser/{chunk-H3OJ4WLF.mjs → chunk-AYF2TX65.mjs} +5 -5
  11. package/dist/lib/browser/{chunk-H3OJ4WLF.mjs.map → chunk-AYF2TX65.mjs.map} +1 -1
  12. package/dist/lib/browser/{chunk-DQCYMXEU.mjs → chunk-JT37R5HS.mjs} +149 -107
  13. package/dist/lib/browser/chunk-JT37R5HS.mjs.map +7 -0
  14. package/dist/lib/browser/{chunk-X2HDG62A.mjs → chunk-KF26WA4O.mjs} +3 -3
  15. package/dist/lib/browser/{chunk-X2HDG62A.mjs.map → chunk-KF26WA4O.mjs.map} +1 -1
  16. package/dist/lib/browser/index.mjs +9 -9
  17. package/dist/lib/browser/{keyboard-OJZC54PK.mjs → keyboard-HYGFQO7T.mjs} +6 -3
  18. package/dist/lib/browser/{keyboard-OJZC54PK.mjs.map → keyboard-HYGFQO7T.mjs.map} +2 -2
  19. package/dist/lib/browser/meta.json +1 -1
  20. package/dist/lib/browser/{operation-resolver-BNAMYOHF.mjs → operation-resolver-VDWVUII5.mjs} +18 -22
  21. package/dist/lib/browser/operation-resolver-VDWVUII5.mjs.map +7 -0
  22. package/dist/lib/browser/{react-surface-AYHOAJ4I.mjs → react-surface-D2RLMV4Z.mjs} +8 -8
  23. package/dist/lib/browser/{react-surface-AYHOAJ4I.mjs.map → react-surface-D2RLMV4Z.mjs.map} +1 -1
  24. package/dist/lib/browser/{state-AC3EETN7.mjs → state-CWMNNF7K.mjs} +4 -4
  25. package/dist/lib/browser/{state-AC3EETN7.mjs.map → state-CWMNNF7K.mjs.map} +1 -1
  26. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
  27. package/dist/types/src/components/{NavTreeContext.d.ts → NavTreeContext/NavTreeContext.d.ts} +1 -1
  28. package/dist/types/src/components/NavTreeContext/NavTreeContext.d.ts.map +1 -0
  29. package/dist/types/src/components/NavTreeContext/index.d.ts +2 -0
  30. package/dist/types/src/components/NavTreeContext/index.d.ts.map +1 -0
  31. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +4 -2
  32. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
  33. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -1
  34. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
  35. package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
  36. package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -1
  37. package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -1
  38. package/dist/types/src/containers/NavTreeContainer/index.d.ts +2 -2
  39. package/dist/types/src/containers/NavTreeContainer/index.d.ts.map +1 -1
  40. package/dist/types/src/containers/index.d.ts +1 -1
  41. package/dist/types/src/containers/index.d.ts.map +1 -1
  42. package/dist/types/src/hooks/useActions.d.ts +1 -3
  43. package/dist/types/src/hooks/useActions.d.ts.map +1 -1
  44. package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -1
  45. package/dist/types/src/meta.d.ts.map +1 -1
  46. package/dist/types/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +36 -36
  48. package/src/capabilities/keyboard/keyboard.ts +1 -1
  49. package/src/capabilities/operation-resolver/operation-resolver.ts +18 -17
  50. package/src/capabilities/react-surface/react-surface.tsx +3 -3
  51. package/src/capabilities/state/state.ts +1 -1
  52. package/src/components/NavTree/NavTree.stories.tsx +1 -1
  53. package/src/components/{NavTreeContext.tsx → NavTreeContext/NavTreeContext.tsx} +1 -1
  54. package/src/components/NavTreeContext/index.ts +5 -0
  55. package/src/components/NavTreeItem/NavTreeItemAction.tsx +25 -7
  56. package/src/components/NavTreeItem/NavTreeItemColumns.tsx +3 -1
  57. package/src/components/Sidebar/L0Menu.tsx +1 -1
  58. package/src/components/Sidebar/L1Panel.tsx +21 -4
  59. package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +53 -51
  60. package/src/containers/NavTreeContainer/NavTreeContainer.tsx +4 -3
  61. package/src/containers/NavTreeContainer/index.ts +2 -3
  62. package/src/containers/index.ts +1 -1
  63. package/src/hooks/useActions.ts +17 -21
  64. package/src/hooks/useNavTreeModel.ts +8 -2
  65. package/src/meta.ts +2 -2
  66. package/src/testing/app-graph-builder.ts +5 -5
  67. package/src/testing/generator.ts +1 -1
  68. package/src/types/capabilities.ts +1 -1
  69. package/dist/lib/browser/CommandsDialogContent-A27AKTHH.mjs.map +0 -7
  70. package/dist/lib/browser/NavTreeContainer-B5K4FUJS.mjs +0 -12
  71. package/dist/lib/browser/NavTreeContainer-B5K4FUJS.mjs.map +0 -7
  72. package/dist/lib/browser/chunk-DQCYMXEU.mjs.map +0 -7
  73. package/dist/lib/browser/operation-resolver-BNAMYOHF.mjs.map +0 -7
  74. package/dist/types/src/components/NavTreeContext.d.ts.map +0 -1
  75. /package/dist/lib/browser/{CommandsTrigger-HBZYQCGV.mjs.map → CommandsTrigger-ABODVVMP.mjs.map} +0 -0
  76. /package/dist/lib/browser/{NavTreeDocumentTitle-GEE3URWH.mjs.map → NavTreeDocumentTitle-L6NLLWLD.mjs.map} +0 -0
  77. /package/dist/lib/browser/{app-graph-builder-XGA4GPGL.mjs.map → app-graph-builder-Z43OTNI2.mjs.map} +0 -0
@@ -1,16 +1,88 @@
1
1
  import {
2
2
  NavTreeCapabilities
3
- } from "./chunk-X2HDG62A.mjs";
3
+ } from "./chunk-KF26WA4O.mjs";
4
4
  import {
5
5
  meta
6
- } from "./chunk-YKTYPINZ.mjs";
6
+ } from "./chunk-A4VDCIJC.mjs";
7
+
8
+ // src/containers/NavTreeContainer/NavTreeContainer.tsx
9
+ import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
10
+ import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
11
+ import React8, { forwardRef as forwardRef3, memo as memo4, useCallback as useCallback4, useEffect as useEffect2, useMemo as useMemo8, useRef as useRef2 } from "react";
12
+ import { Surface, useOperationInvoker } from "@dxos/app-framework/ui";
13
+ import { LayoutOperation } from "@dxos/app-toolkit";
14
+ import { useAppGraph as useAppGraph6, useLayout } from "@dxos/app-toolkit/ui";
15
+ import { Graph as Graph5, Node as Node6, useActionRunner as useActionRunner4 } from "@dxos/plugin-graph";
16
+ import { useMediaQuery as useMediaQuery2, useSidebars } from "@dxos/react-ui";
17
+ import { isTreeData } from "@dxos/react-ui-list";
18
+ import { arrayMove as arrayMove2 } from "@dxos/util";
19
+
20
+ // src/components/NavTree/NavTree.tsx
21
+ import React7, { forwardRef as forwardRef2, useMemo as useMemo7 } from "react";
22
+ import { useAppGraph as useAppGraph5 } from "@dxos/app-toolkit/ui";
23
+ import { Node as Node5, useConnections as useConnections2, useActions as useGraphActions2 } from "@dxos/plugin-graph";
24
+ import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
25
+ import { byPosition } from "@dxos/util";
26
+
27
+ // src/hooks/useActions.ts
28
+ import { useMemo } from "react";
29
+ import { useAppGraph } from "@dxos/app-toolkit/ui";
30
+ import { Graph, Node, useActions as useGraphActions } from "@dxos/plugin-graph";
31
+ var useActions = (node) => {
32
+ const { graph } = useAppGraph();
33
+ const actions = useGraphActions(graph, node.id);
34
+ return useMemo(() => {
35
+ return actions.reduce((acc, arg) => {
36
+ if (arg.properties.disposition === "item") {
37
+ return acc;
38
+ }
39
+ acc.actions.push(arg);
40
+ if (!Node.isAction(arg)) {
41
+ const actionGroup = Graph.getActions(graph, arg.id);
42
+ acc.groupedActions[arg.id] = actionGroup;
43
+ }
44
+ return acc;
45
+ }, {
46
+ actions: [],
47
+ groupedActions: {}
48
+ });
49
+ }, [
50
+ actions
51
+ ]);
52
+ };
53
+
54
+ // src/hooks/useLoadDescendents.ts
55
+ import { useEffect } from "react";
56
+ import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
57
+ import { Graph as Graph2 } from "@dxos/plugin-graph";
58
+ var useLoadDescendents = (root) => {
59
+ const { graph } = useAppGraph2();
60
+ useEffect(() => {
61
+ if (!root) {
62
+ return;
63
+ }
64
+ Graph2.expand(graph, root.id, "child");
65
+ }, [
66
+ graph,
67
+ root
68
+ ]);
69
+ };
70
+
71
+ // src/hooks/useNavTreeModel.ts
72
+ import { Atom } from "@effect-atom/atom-react";
73
+ import * as Option from "effect/Option";
74
+ import { useMemo as useMemo3 } from "react";
75
+ import { useAppGraph as useAppGraph3 } from "@dxos/app-toolkit/ui";
76
+ import { PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
77
+ import { Path } from "@dxos/react-ui-list";
78
+ import { mx } from "@dxos/ui-theme";
7
79
 
8
80
  // src/util.ts
9
- import { Graph, Node } from "@dxos/plugin-graph";
81
+ import { Graph as Graph3, Node as Node2 } from "@dxos/plugin-graph";
10
82
  import { isNonNullable } from "@dxos/util";
11
83
  var getParent = (graph, node, path) => {
12
84
  const parentId = path[path.length - 2];
13
- return Graph.getConnections(graph, node.id, Node.childRelation("inbound")).find((n) => n.id === parentId);
85
+ return Graph3.getConnections(graph, node.id, Node2.childRelation("inbound")).find((n) => n.id === parentId);
14
86
  };
15
87
  var getPersistenceParent = (graph, node, path, persistenceClass) => {
16
88
  if (node.properties.acceptPersistenceClass?.has(persistenceClass)) {
@@ -48,7 +120,7 @@ var sortActions = (actions) => actions.sort((a, b) => {
48
120
  return 1;
49
121
  });
50
122
  var getChildren = (graph, node, path = []) => {
51
- return Graph.getConnections(graph, node.id, "child").map((n) => {
123
+ return Graph3.getConnections(graph, node.id, "child").map((n) => {
52
124
  const nextPath = [
53
125
  ...path,
54
126
  node.id
@@ -60,90 +132,20 @@ var filterItems = (node, disposition) => {
60
132
  if (!disposition && (node.properties.disposition === "hidden" || node.properties.disposition === "alternate-tree")) {
61
133
  return false;
62
134
  } else if (!disposition) {
63
- const action = Node.isAction(node);
135
+ const action = Node2.isAction(node);
64
136
  return !action || node.properties.disposition === "item";
65
137
  } else {
66
138
  return node.properties.disposition === disposition;
67
139
  }
68
140
  };
69
141
  var l0ItemType = (item) => {
70
- if (Node.isActionLike(item)) {
142
+ if (Node2.isActionLike(item)) {
71
143
  return "action";
72
144
  } else {
73
145
  return "tab";
74
146
  }
75
147
  };
76
148
 
77
- // src/containers/NavTreeContainer/NavTreeContainer.tsx
78
- import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
79
- import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
80
- import React8, { forwardRef as forwardRef3, memo as memo4, useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo8, useRef as useRef2 } from "react";
81
- import { Surface, useOperationInvoker } from "@dxos/app-framework/ui";
82
- import { LayoutOperation } from "@dxos/app-toolkit";
83
- import { useAppGraph as useAppGraph6, useLayout } from "@dxos/app-toolkit/ui";
84
- import { Graph as Graph5, Node as Node6, useActionRunner as useActionRunner4 } from "@dxos/plugin-graph";
85
- import { useMediaQuery as useMediaQuery2, useSidebars } from "@dxos/react-ui";
86
- import { isTreeData } from "@dxos/react-ui-list";
87
- import { arrayMove as arrayMove2 } from "@dxos/util";
88
-
89
- // src/components/NavTree/NavTree.tsx
90
- import React7, { forwardRef as forwardRef2, useMemo as useMemo7 } from "react";
91
- import { useAppGraph as useAppGraph5 } from "@dxos/app-toolkit/ui";
92
- import { Node as Node5, useConnections as useConnections2, useActions as useGraphActions2 } from "@dxos/plugin-graph";
93
- import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
94
- import { byPosition } from "@dxos/util";
95
-
96
- // src/hooks/useActions.ts
97
- import { useMemo } from "react";
98
- import { useAppGraph } from "@dxos/app-toolkit/ui";
99
- import { Graph as Graph2, Node as Node2, useActions as useGraphActions } from "@dxos/plugin-graph";
100
- var useActions = (node) => {
101
- const { graph } = useAppGraph();
102
- const actions = useGraphActions(graph, node.id);
103
- return useMemo(() => actions.reduce((acc, arg) => {
104
- if (arg.properties.disposition === "item") {
105
- return acc;
106
- }
107
- acc.actions.push(arg);
108
- if (!Node2.isAction(arg)) {
109
- const actionGroup = Graph2.getActions(graph, arg.id);
110
- acc.groupedActions[arg.id] = actionGroup;
111
- }
112
- return acc;
113
- }, {
114
- actions: [],
115
- groupedActions: {}
116
- }), [
117
- actions
118
- ]);
119
- };
120
-
121
- // src/hooks/useLoadDescendents.ts
122
- import { useEffect } from "react";
123
- import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
124
- import { Graph as Graph3 } from "@dxos/plugin-graph";
125
- var useLoadDescendents = (root) => {
126
- const { graph } = useAppGraph2();
127
- useEffect(() => {
128
- if (!root) {
129
- return;
130
- }
131
- Graph3.expand(graph, root.id, "child");
132
- }, [
133
- graph,
134
- root
135
- ]);
136
- };
137
-
138
- // src/hooks/useNavTreeModel.ts
139
- import { Atom } from "@effect-atom/atom-react";
140
- import * as Option from "effect/Option";
141
- import { useMemo as useMemo3 } from "react";
142
- import { useAppGraph as useAppGraph3 } from "@dxos/app-toolkit/ui";
143
- import { PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
144
- import { Path } from "@dxos/react-ui-list";
145
- import { mx } from "@dxos/ui-theme";
146
-
147
149
  // src/hooks/useNavTreeState.ts
148
150
  import { useAtomValue } from "@effect-atom/atom-react";
149
151
  import { useMemo as useMemo2 } from "react";
@@ -183,10 +185,15 @@ var createItemPropsFamily = (graph) => Atom.family((pathKey) => {
183
185
  const safeChildren = get(graph.connections(node.id, "child")).filter((child) => !path.includes(child.id));
184
186
  const visibleChildren = safeChildren.filter(isVisibleChild);
185
187
  const parentOf = visibleChildren.length > 0 ? visibleChildren.map((child) => child.id) : node.properties.role === "branch" ? [] : void 0;
188
+ const parentId = path.length >= 2 ? path[path.length - 2] : void 0;
189
+ const parentNode = parentId ? Option.getOrElse(get(graph.node(parentId)), () => void 0) : void 0;
190
+ const droppable = node.properties.droppable === false || parentNode?.properties.childrenDroppable === false ? false : void 0;
186
191
  return {
187
192
  id: node.id,
188
193
  parentOf,
189
194
  disabled: node.properties.disabled,
195
+ draggable: node.properties.draggable,
196
+ droppable,
190
197
  label: node.properties.label ?? node.id,
191
198
  className: mx(node.properties.className, node.properties.modified && "italic"),
192
199
  headingClassName: node.properties.headingClassName,
@@ -199,8 +206,7 @@ var createItemPropsFamily = (graph) => Atom.family((pathKey) => {
199
206
  var createChildIdsFamily = (graph) => Atom.family((id) => Atom.make((get) => get(graph.connections(id, "child")).map((child) => child.id)).pipe(Atom.keepAlive));
200
207
  var createItemFamily = (graph) => Atom.family((id) => Atom.make((get) => {
201
208
  const node = Option.getOrElse(get(graph.node(id)), () => void 0);
202
- const passed = node ? filterItems(node) : false;
203
- return node && passed ? node : void 0;
209
+ return node && filterItems(node) ? node : void 0;
204
210
  }).pipe(Atom.keepAlive));
205
211
  var createItemOpenFamily = (getItemAtom) => Atom.family((pathKey) => {
206
212
  const path = Path.parts(pathKey);
@@ -246,7 +252,7 @@ var useNavTreeModel = (rootId) => {
246
252
  ]);
247
253
  };
248
254
 
249
- // src/components/NavTreeContext.tsx
255
+ // src/components/NavTreeContext/NavTreeContext.tsx
250
256
  import { createContext, useContext } from "react";
251
257
  import { raise } from "@dxos/debug";
252
258
  var NavTreeContext = /* @__PURE__ */ createContext(null);
@@ -301,9 +307,11 @@ var useL0ItemClick = ({ item, parent, path }, type) => {
301
307
  const { properties: { caller } = {} } = item;
302
308
  return void runAction(item, caller ? {
303
309
  parent,
310
+ path,
304
311
  caller
305
312
  } : {
306
- parent
313
+ parent,
314
+ path
307
315
  });
308
316
  }
309
317
  case "tab":
@@ -612,18 +620,20 @@ var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent
612
620
  // src/components/Sidebar/L1Panel.tsx
613
621
  import * as Effect from "effect/Effect";
614
622
  import * as Option2 from "effect/Option";
615
- import React5, { memo as memo3, useCallback as useCallback2, useMemo as useMemo6 } from "react";
623
+ import React5, { memo as memo3, useCallback as useCallback3, useMemo as useMemo6 } from "react";
616
624
  import { Node as Node4 } from "@dxos/app-graph";
625
+ import { isPinnedWorkspace } from "@dxos/app-toolkit";
617
626
  import { useAppGraph as useAppGraph4 } from "@dxos/app-toolkit/ui";
618
627
  import { Graph as Graph4, useActionRunner as useActionRunner3, useConnections, useEdges } from "@dxos/plugin-graph";
619
628
  import { DensityProvider, IconButton as IconButton2, ScrollArea as ScrollArea2, toLocalizedString as toLocalizedString4, useTranslation as useTranslation4 } from "@dxos/react-ui";
629
+ import { useAttended } from "@dxos/react-ui-attention";
620
630
  import { Tree } from "@dxos/react-ui-list";
621
631
  import { Menu as Menu3 } from "@dxos/react-ui-menu";
622
632
  import { Tabs as Tabs2 } from "@dxos/react-ui-tabs";
623
633
  import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2 } from "@dxos/ui-theme";
624
634
 
625
635
  // src/components/NavTreeItem/NavTreeItemAction.tsx
626
- import React3 from "react";
636
+ import React3, { useCallback as useCallback2 } from "react";
627
637
  import { useActionRunner as useActionRunner2 } from "@dxos/plugin-graph";
628
638
  import { IconButton, toLocalizedString as toLocalizedString2, useDensityContext, useTranslation as useTranslation2 } from "@dxos/react-ui";
629
639
  import { Menu as Menu2 } from "@dxos/react-ui-menu";
@@ -637,13 +647,20 @@ var coarseActionButtonProps = {
637
647
  size: 5,
638
648
  density: "coarse"
639
649
  };
640
- var NavTreeItemActionDropdownMenu = ({ parent, label, icon, testId, menuActions, caller }) => {
650
+ var NavTreeItemActionDropdownMenu = ({ parent, path, label, icon, testId, menuActions, caller }) => {
641
651
  const { t } = useTranslation2(meta.id);
642
652
  const density = useDensityContext();
643
653
  const runAction = useActionRunner2();
654
+ const handleAction = useCallback2((action, params = {}) => runAction(action, {
655
+ ...params,
656
+ path
657
+ }), [
658
+ runAction,
659
+ path
660
+ ]);
644
661
  return /* @__PURE__ */ React3.createElement(Menu2.Root, {
645
662
  caller,
646
- onAction: runAction
663
+ onAction: handleAction
647
664
  }, /* @__PURE__ */ React3.createElement(Menu2.Trigger, {
648
665
  asChild: true
649
666
  }, /* @__PURE__ */ React3.createElement(IconButton, {
@@ -664,7 +681,7 @@ var NavTreeItemActionDropdownMenu = ({ parent, label, icon, testId, menuActions,
664
681
  }));
665
682
  };
666
683
  var NavTreeItemMonolithicAction = (props) => {
667
- const { parent, properties: { disabled, caller, testId, icon, variant = "ghost", iconOnly = true } = {
684
+ const { parent, path, properties: { disabled, caller, testId, icon, variant = "ghost", iconOnly = true } = {
668
685
  label: "never"
669
686
  }, baseLabel } = props;
670
687
  const density = useDensityContext();
@@ -689,26 +706,30 @@ var NavTreeItemMonolithicAction = (props) => {
689
706
  }
690
707
  void runAction(props, caller ? {
691
708
  parent,
692
- caller
709
+ caller,
710
+ path
693
711
  } : {
694
- parent
712
+ parent,
713
+ path
695
714
  });
696
715
  },
697
716
  "data-testid": testId
698
717
  });
699
718
  };
700
- var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) => {
719
+ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, path, ...props }) => {
701
720
  const { t } = useTranslation2(meta.id);
702
721
  const monolithicAction = menuActions?.length === 1 && menuActions[0];
703
722
  const baseLabel = toLocalizedString2(monolithicAction ? monolithicAction.properties.label : props.label, t);
704
723
  return monolithic && menuActions?.length === 1 ? /* @__PURE__ */ React3.createElement(NavTreeItemMonolithicAction, {
705
724
  baseLabel,
706
725
  parent: node,
726
+ path,
707
727
  ...menuActions[0]
708
728
  }) : /* @__PURE__ */ React3.createElement(NavTreeItemActionDropdownMenu, {
709
729
  ...props,
710
730
  label: baseLabel,
711
731
  parent: node,
732
+ path,
712
733
  menuActions
713
734
  });
714
735
  };
@@ -751,7 +772,7 @@ var NavTreeItemColumns = /* @__PURE__ */ memo2(({ path, item, open }) => {
751
772
  primaryAction,
752
773
  groupedActions
753
774
  ]);
754
- const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
775
+ const ActionRoot = popoverAnchorId === `${NAV_TREE_ITEM}:${item.id}` ? Popover.Anchor : Fragment;
755
776
  return /* @__PURE__ */ React4.createElement("div", {
756
777
  role: "none",
757
778
  className: "contents dx-app-no-drag"
@@ -762,6 +783,7 @@ var NavTreeItemColumns = /* @__PURE__ */ memo2(({ path, item, open }) => {
762
783
  label: toLocalizedString3(primaryAction.properties?.label, t),
763
784
  icon: primaryAction.properties?.icon ?? "ph--placeholder--regular",
764
785
  parent: item,
786
+ path,
765
787
  monolithic: Node3.isAction(primaryAction),
766
788
  menuActions: primaryMenuActions,
767
789
  menuType: primaryAction.properties?.menuType,
@@ -775,6 +797,7 @@ var NavTreeItemColumns = /* @__PURE__ */ memo2(({ path, item, open }) => {
775
797
  label: t("tree item actions label"),
776
798
  icon: "ph--dots-three-vertical--regular",
777
799
  parent: item,
800
+ path,
778
801
  menuActions: actions,
779
802
  menuType: "dropdown",
780
803
  caller: NAV_TREE_ITEM
@@ -890,12 +913,24 @@ var L1PanelHeader = ({ item, path, onBack }) => {
890
913
  const { t } = useTranslation4(meta.id);
891
914
  const { renderItemEnd: ItemEnd } = useNavTreeContext();
892
915
  const title = toLocalizedString4(item.properties.label, t);
893
- const backCapableWorkspace = item.id.startsWith("!");
916
+ const backCapableWorkspace = isPinnedWorkspace(item.id);
894
917
  const { primaryAction, groupedActions, menuActions, onAction } = useL1MenuActions({
895
918
  item,
896
919
  path
897
920
  });
898
921
  useLoadDescendents(item);
922
+ const alternateTree = useAlternateTreeItem(item);
923
+ const attended = useAttended();
924
+ const alternateTreeOpen = useMemo6(() => {
925
+ if (!alternateTree) {
926
+ return true;
927
+ }
928
+ const hasAlternateAttended = attended.some((attendedId) => attendedId === alternateTree.id || attendedId.startsWith(alternateTree.id + "/"));
929
+ return !hasAlternateAttended;
930
+ }, [
931
+ alternateTree,
932
+ attended
933
+ ]);
899
934
  return /* @__PURE__ */ React5.createElement("div", {
900
935
  className: "flex w-full items-center border-b border-subdued-separator dx-app-drag dx-density-coarse pe-1"
901
936
  }, backCapableWorkspace ? /* @__PURE__ */ React5.createElement(IconButton2, {
@@ -924,6 +959,7 @@ var L1PanelHeader = ({ item, path, onBack }) => {
924
959
  label: toLocalizedString4(primaryAction.properties?.label, t),
925
960
  icon: primaryAction.properties?.icon ?? "ph--placeholder--regular",
926
961
  parent: item,
962
+ path,
927
963
  monolithic: Node4.isAction(primaryAction),
928
964
  menuActions: Node4.isAction(primaryAction) ? [
929
965
  primaryAction
@@ -967,7 +1003,7 @@ var L1PanelHeader = ({ item, path, onBack }) => {
967
1003
  items: menuActions
968
1004
  })), ItemEnd && /* @__PURE__ */ React5.createElement(ItemEnd, {
969
1005
  node: item,
970
- open: true
1006
+ open: alternateTreeOpen
971
1007
  })));
972
1008
  };
973
1009
  var useL1MenuActions = ({ item, path }) => {
@@ -1028,14 +1064,17 @@ var useL1MenuActions = ({ item, path }) => {
1028
1064
  graphMenuActions,
1029
1065
  settingsAction
1030
1066
  ]);
1031
- const onAction = useCallback2((action, params) => {
1067
+ const onAction = useCallback3((action, params) => {
1032
1068
  if (action.id === settingsActionId) {
1033
1069
  if (alternateTree && !isAlternate) {
1034
1070
  Graph4.expand(graph, alternateTree.id, "child");
1035
1071
  }
1036
1072
  setAlternateTree?.(alternatePath, !isAlternate);
1037
1073
  } else {
1038
- void runAction(action, params);
1074
+ void runAction(action, {
1075
+ ...params,
1076
+ path
1077
+ });
1039
1078
  }
1040
1079
  }, [
1041
1080
  settingsActionId,
@@ -1044,7 +1083,8 @@ var useL1MenuActions = ({ item, path }) => {
1044
1083
  isAlternate,
1045
1084
  runAction,
1046
1085
  graph,
1047
- alternateTree
1086
+ alternateTree,
1087
+ path
1048
1088
  ]);
1049
1089
  return {
1050
1090
  primaryAction,
@@ -1224,14 +1264,14 @@ var NavTreeContainer$ = /* @__PURE__ */ forwardRef3(({ tab, popoverAnchorId }, f
1224
1264
  navigationSidebarState,
1225
1265
  isLg
1226
1266
  ]);
1227
- const handleOpenChange = useCallback3(({ item: { id }, path, open }) => {
1267
+ const handleOpenChange = useCallback4(({ item: { id }, path, open }) => {
1228
1268
  setItem(path, "open", open);
1229
1269
  Graph5.expand(graph, id, "child");
1230
1270
  }, [
1231
1271
  graph,
1232
1272
  setItem
1233
1273
  ]);
1234
- const handleTabChange = useCallback3((node) => {
1274
+ const handleTabChange = useCallback4((node) => {
1235
1275
  Graph5.expand(graph, node.id, "child");
1236
1276
  const { tab: activeTab, activeItems, navigationSidebarState: currentSidebarState, isLg: latestIsLg } = latestRef.current;
1237
1277
  invokeSync(LayoutOperation.UpdateSidebar, {
@@ -1254,16 +1294,16 @@ var NavTreeContainer$ = /* @__PURE__ */ forwardRef3(({ tab, popoverAnchorId }, f
1254
1294
  invokeSync,
1255
1295
  graph
1256
1296
  ]);
1257
- const blockInstruction = useCallback3(({ instruction, source, target }) => {
1297
+ const blockInstruction = useCallback4(({ instruction, source, target }) => {
1258
1298
  return target.item.properties.blockInstruction?.(source, instruction) ?? false;
1259
1299
  }, []);
1260
- const canDrop = useCallback3(({ source, target }) => {
1300
+ const canDrop = useCallback4(({ source, target }) => {
1261
1301
  return target.item.properties.canDrop?.(source) ?? false;
1262
1302
  }, []);
1263
- const canSelect = useCallback3(({ item }) => {
1303
+ const canSelect = useCallback4(({ item }) => {
1264
1304
  return item.properties.selectable ?? true;
1265
1305
  }, []);
1266
- const handleSelect = useCallback3(({ item: node, path, option }) => {
1306
+ const handleSelect = useCallback4(({ item: node, path, option }) => {
1267
1307
  if (!node.data) {
1268
1308
  return;
1269
1309
  }
@@ -1272,6 +1312,7 @@ var NavTreeContainer$ = /* @__PURE__ */ forwardRef3(({ tab, popoverAnchorId }, f
1272
1312
  if (parent) {
1273
1313
  void runAction(node, {
1274
1314
  parent,
1315
+ path,
1275
1316
  caller: NAV_TREE_ITEM
1276
1317
  });
1277
1318
  }
@@ -1313,7 +1354,7 @@ var NavTreeContainer$ = /* @__PURE__ */ forwardRef3(({ tab, popoverAnchorId }, f
1313
1354
  runAction,
1314
1355
  isLg
1315
1356
  ]);
1316
- const handleBack = useCallback3(() => invokeSync(LayoutOperation.RevertWorkspace), [
1357
+ const handleBack = useCallback4(() => invokeSync(LayoutOperation.RevertWorkspace), [
1317
1358
  invokeSync
1318
1359
  ]);
1319
1360
  useEffect2(() => {
@@ -1330,7 +1371,8 @@ var NavTreeContainer$ = /* @__PURE__ */ forwardRef3(({ tab, popoverAnchorId }, f
1330
1371
  const targetNode = target.data.item;
1331
1372
  const sourcePath = source.data.path;
1332
1373
  const targetPath = target.data.path;
1333
- const operation = sourcePath.slice(0, -1).join() === targetPath.slice(0, -1).join() && instruction.type !== "make-child" ? "rearrange" : resolveMigrationOperation(graph, sourceNode, targetPath, targetNode);
1374
+ const sameParent = sourcePath.slice(0, -1).join() === targetPath.slice(0, -1).join();
1375
+ const operation = sameParent && instruction.type !== "make-child" ? "rearrange" : resolveMigrationOperation(graph, sourceNode, targetPath, targetNode);
1334
1376
  const sourceParent = getParent(graph, sourceNode, sourcePath);
1335
1377
  const targetParent = getParent(graph, targetNode, targetPath);
1336
1378
  const sourceItems = getItems(graph, sourceParent);
@@ -1352,7 +1394,7 @@ var NavTreeContainer$ = /* @__PURE__ */ forwardRef3(({ tab, popoverAnchorId }, f
1352
1394
  }
1353
1395
  case "transfer": {
1354
1396
  const target2 = instruction.type === "make-child" ? targetNode : targetParent;
1355
- if (!target2?.properties.onTransferStart || !sourceParent?.properties.onTransferEnd) {
1397
+ if (!target2?.properties.onTransferStart || target2?.id === sourceParent?.id) {
1356
1398
  break;
1357
1399
  }
1358
1400
  void target2?.properties.onTransferStart(sourceNode, migrationIndex);
@@ -1366,12 +1408,12 @@ var NavTreeContainer$ = /* @__PURE__ */ forwardRef3(({ tab, popoverAnchorId }, f
1366
1408
  }, [
1367
1409
  graph
1368
1410
  ]);
1369
- const setAlternateTree = useCallback3((path, open) => {
1411
+ const setAlternateTree = useCallback4((path, open) => {
1370
1412
  setItem(path, "alternateTree", open);
1371
1413
  }, [
1372
1414
  setItem
1373
1415
  ]);
1374
- const onItemHover = useCallback3(({ item }) => Graph5.expand(graph, item.id, "child"), [
1416
+ const onItemHover = useCallback4(({ item }) => Graph5.expand(graph, item.id, "child"), [
1375
1417
  graph
1376
1418
  ]);
1377
1419
  const navTreeContextValue = useMemo8(() => ({
@@ -1423,4 +1465,4 @@ export {
1423
1465
  NODE_TYPE,
1424
1466
  NavTreeContainer
1425
1467
  };
1426
- //# sourceMappingURL=chunk-DQCYMXEU.mjs.map
1468
+ //# sourceMappingURL=chunk-JT37R5HS.mjs.map