@dxos/plugin-navtree 0.8.4-main.c1de068 → 0.8.4-main.c351d160a8

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 (245) hide show
  1. package/dist/lib/browser/CommandsDialogContent-2DKIOLJL.mjs +113 -0
  2. package/dist/lib/browser/CommandsDialogContent-2DKIOLJL.mjs.map +7 -0
  3. package/dist/lib/browser/CommandsTrigger-ABODVVMP.mjs +33 -0
  4. package/dist/lib/browser/CommandsTrigger-ABODVVMP.mjs.map +7 -0
  5. package/dist/lib/browser/NavTreeContainer-IQZCK4Y4.mjs +12 -0
  6. package/dist/lib/browser/NavTreeContainer-IQZCK4Y4.mjs.map +7 -0
  7. package/dist/lib/browser/NavTreeDocumentTitle-L6NLLWLD.mjs +26 -0
  8. package/dist/lib/browser/NavTreeDocumentTitle-L6NLLWLD.mjs.map +7 -0
  9. package/dist/lib/browser/app-graph-builder-Z43OTNI2.mjs +44 -0
  10. package/dist/lib/browser/app-graph-builder-Z43OTNI2.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-A4VDCIJC.mjs +19 -0
  12. package/dist/lib/browser/chunk-A4VDCIJC.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-DINDC6HE.mjs +14 -0
  14. package/dist/lib/browser/chunk-DINDC6HE.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-KF26WA4O.mjs +23 -0
  16. package/dist/lib/browser/chunk-KF26WA4O.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-OGUYILOW.mjs +1462 -0
  18. package/dist/lib/browser/chunk-OGUYILOW.mjs.map +7 -0
  19. package/dist/lib/browser/index.mjs +88 -96
  20. package/dist/lib/browser/index.mjs.map +4 -4
  21. package/dist/lib/browser/{keyboard-QRS6WOQH.mjs → keyboard-HYGFQO7T.mjs} +25 -19
  22. package/dist/lib/browser/keyboard-HYGFQO7T.mjs.map +7 -0
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/operation-resolver-VDWVUII5.mjs +49 -0
  25. package/dist/lib/browser/operation-resolver-VDWVUII5.mjs.map +7 -0
  26. package/dist/lib/browser/react-surface-LFMKIKNY.mjs +59 -0
  27. package/dist/lib/browser/react-surface-LFMKIKNY.mjs.map +7 -0
  28. package/dist/lib/browser/state-CWMNNF7K.mjs +131 -0
  29. package/dist/lib/browser/state-CWMNNF7K.mjs.map +7 -0
  30. package/dist/types/src/NavTreePlugin.d.ts +2 -1
  31. package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
  32. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  33. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  35. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/index.d.ts +5 -105
  37. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  38. package/dist/types/src/capabilities/keyboard/index.d.ts +3 -0
  39. package/dist/types/src/capabilities/keyboard/index.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/keyboard/keyboard.d.ts +5 -0
  41. package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  43. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  44. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  45. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  46. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  47. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  48. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  49. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  50. package/dist/types/src/capabilities/state/index.d.ts +3 -0
  51. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  52. package/dist/types/src/capabilities/state/state.d.ts +6 -0
  53. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  54. package/dist/types/src/components/NavTree/NavTree.d.ts +12 -5
  55. package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
  56. package/dist/types/src/components/NavTree/NavTree.stories.d.ts +27 -5
  57. package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
  58. package/dist/types/src/components/{NavTreeContext.d.ts → NavTreeContext/NavTreeContext.d.ts} +1 -1
  59. package/dist/types/src/components/NavTreeContext/NavTreeContext.d.ts.map +1 -0
  60. package/dist/types/src/components/NavTreeContext/index.d.ts +2 -0
  61. package/dist/types/src/components/NavTreeContext/index.d.ts.map +1 -0
  62. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +10 -8
  63. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
  64. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +33 -4
  65. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
  66. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +2 -2
  67. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
  68. package/dist/types/src/components/Sidebar/L0Menu.d.ts +10 -5
  69. package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
  70. package/dist/types/src/components/Sidebar/L1Panel.d.ts +4 -8
  71. package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
  72. package/dist/types/src/components/Sidebar/L1Tabs.d.ts +13 -0
  73. package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -0
  74. package/dist/types/src/components/Sidebar/index.d.ts +1 -0
  75. package/dist/types/src/components/Sidebar/index.d.ts.map +1 -1
  76. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
  77. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +8 -5
  78. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
  79. package/dist/types/src/components/index.d.ts +0 -3
  80. package/dist/types/src/components/index.d.ts.map +1 -1
  81. package/dist/types/src/components/types.d.ts +8 -16
  82. package/dist/types/src/components/types.d.ts.map +1 -1
  83. package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts +6 -0
  84. package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -0
  85. package/dist/types/src/containers/CommandsDialogContent/index.d.ts +3 -0
  86. package/dist/types/src/containers/CommandsDialogContent/index.d.ts.map +1 -0
  87. package/dist/types/src/containers/CommandsTrigger/CommandsTrigger.d.ts.map +1 -0
  88. package/dist/types/src/containers/CommandsTrigger/index.d.ts +3 -0
  89. package/dist/types/src/containers/CommandsTrigger/index.d.ts.map +1 -0
  90. package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts +9 -0
  91. package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -0
  92. package/dist/types/src/containers/NavTreeContainer/index.d.ts +3 -0
  93. package/dist/types/src/containers/NavTreeContainer/index.d.ts.map +1 -0
  94. package/dist/types/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.d.ts +1 -1
  95. package/dist/types/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.d.ts.map +1 -0
  96. package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts +3 -0
  97. package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts.map +1 -0
  98. package/dist/types/src/containers/index.d.ts +7 -0
  99. package/dist/types/src/containers/index.d.ts.map +1 -0
  100. package/dist/types/src/experimental/Tree.d.ts +1 -2
  101. package/dist/types/src/experimental/Tree.d.ts.map +1 -1
  102. package/dist/types/src/experimental/Tree.stories.d.ts +23 -6
  103. package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
  104. package/dist/types/src/hooks/index.d.ts +5 -0
  105. package/dist/types/src/hooks/index.d.ts.map +1 -0
  106. package/dist/types/src/hooks/useActions.d.ts +5 -0
  107. package/dist/types/src/hooks/useActions.d.ts.map +1 -0
  108. package/dist/types/src/hooks/useLoadDescendents.d.ts +6 -0
  109. package/dist/types/src/hooks/useLoadDescendents.d.ts.map +1 -0
  110. package/dist/types/src/hooks/useNavTreeModel.d.ts +7 -0
  111. package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -0
  112. package/dist/types/src/hooks/useNavTreeState.d.ts +22 -0
  113. package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
  114. package/dist/types/src/index.d.ts +1 -2
  115. package/dist/types/src/index.d.ts.map +1 -1
  116. package/dist/types/src/meta.d.ts +3 -4
  117. package/dist/types/src/meta.d.ts.map +1 -1
  118. package/dist/types/src/testing/app-graph-builder.d.ts +2 -3
  119. package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
  120. package/dist/types/src/testing/generator.d.ts +5 -6
  121. package/dist/types/src/testing/generator.d.ts.map +1 -1
  122. package/dist/types/src/testing/update-state.d.ts +2 -2
  123. package/dist/types/src/testing/update-state.d.ts.map +1 -1
  124. package/dist/types/src/translations.d.ts +1 -0
  125. package/dist/types/src/translations.d.ts.map +1 -1
  126. package/dist/types/src/types/capabilities.d.ts +16 -0
  127. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  128. package/dist/types/src/types/events.d.ts +5 -0
  129. package/dist/types/src/types/events.d.ts.map +1 -0
  130. package/dist/types/src/types/index.d.ts +4 -0
  131. package/dist/types/src/types/index.d.ts.map +1 -0
  132. package/dist/types/src/{types.d.ts → types/schema.d.ts} +10 -9
  133. package/dist/types/src/types/schema.d.ts.map +1 -0
  134. package/dist/types/src/util.d.ts +12 -9
  135. package/dist/types/src/util.d.ts.map +1 -1
  136. package/dist/types/tsconfig.tsbuildinfo +1 -1
  137. package/package.json +56 -53
  138. package/src/NavTreePlugin.tsx +64 -84
  139. package/src/capabilities/app-graph-builder/app-graph-builder.ts +42 -0
  140. package/src/capabilities/app-graph-builder/index.ts +7 -0
  141. package/src/capabilities/index.ts +5 -9
  142. package/src/capabilities/keyboard/index.ts +7 -0
  143. package/src/capabilities/keyboard/keyboard.ts +66 -0
  144. package/src/capabilities/operation-resolver/index.ts +7 -0
  145. package/src/capabilities/operation-resolver/operation-resolver.ts +45 -0
  146. package/src/capabilities/react-surface/index.ts +7 -0
  147. package/src/capabilities/react-surface/react-surface.tsx +53 -0
  148. package/src/capabilities/state/index.ts +7 -0
  149. package/src/capabilities/state/state.ts +149 -0
  150. package/src/components/NavTree/NavTree.stories.tsx +105 -98
  151. package/src/components/NavTree/NavTree.tsx +69 -34
  152. package/src/components/{NavTreeContext.tsx → NavTreeContext/NavTreeContext.tsx} +1 -1
  153. package/src/components/NavTreeContext/index.ts +5 -0
  154. package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +21 -13
  155. package/src/components/NavTreeItem/NavTreeItemAction.tsx +61 -37
  156. package/src/components/NavTreeItem/NavTreeItemColumns.tsx +69 -37
  157. package/src/components/Sidebar/L0Menu.tsx +163 -191
  158. package/src/components/Sidebar/L1Panel.tsx +265 -134
  159. package/src/components/Sidebar/L1Tabs.tsx +43 -0
  160. package/src/components/Sidebar/index.ts +1 -0
  161. package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +9 -9
  162. package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
  163. package/src/components/index.ts +1 -3
  164. package/src/components/types.ts +15 -19
  165. package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +135 -0
  166. package/src/containers/CommandsDialogContent/index.ts +7 -0
  167. package/src/containers/CommandsTrigger/CommandsTrigger.tsx +26 -0
  168. package/src/containers/CommandsTrigger/index.ts +7 -0
  169. package/src/containers/NavTreeContainer/NavTreeContainer.tsx +271 -0
  170. package/src/containers/NavTreeContainer/index.ts +6 -0
  171. package/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.tsx +5 -4
  172. package/src/containers/NavTreeDocumentTitle/index.ts +7 -0
  173. package/src/containers/index.ts +12 -0
  174. package/src/experimental/Tree.stories.tsx +78 -83
  175. package/src/experimental/Tree.tsx +6 -23
  176. package/src/hooks/index.ts +8 -0
  177. package/src/hooks/useActions.ts +34 -0
  178. package/src/hooks/useLoadDescendents.ts +23 -0
  179. package/src/hooks/useNavTreeModel.ts +118 -0
  180. package/src/hooks/useNavTreeState.ts +42 -0
  181. package/src/index.ts +1 -2
  182. package/src/meta.ts +11 -8
  183. package/src/testing/app-graph-builder.ts +159 -234
  184. package/src/testing/generator.ts +20 -18
  185. package/src/testing/update-state.ts +6 -6
  186. package/src/translations.ts +1 -0
  187. package/src/types/capabilities.ts +21 -0
  188. package/src/types/events.ts +12 -0
  189. package/src/types/index.ts +7 -0
  190. package/src/{types.ts → types/schema.ts} +9 -8
  191. package/src/util.ts +26 -33
  192. package/dist/lib/browser/app-graph-builder-5J4LRWDX.mjs +0 -45
  193. package/dist/lib/browser/app-graph-builder-5J4LRWDX.mjs.map +0 -7
  194. package/dist/lib/browser/chunk-ERDGQTH5.mjs +0 -16
  195. package/dist/lib/browser/chunk-ERDGQTH5.mjs.map +0 -7
  196. package/dist/lib/browser/chunk-SICQTLXC.mjs +0 -1442
  197. package/dist/lib/browser/chunk-SICQTLXC.mjs.map +0 -7
  198. package/dist/lib/browser/chunk-WCARAZ7J.mjs +0 -15
  199. package/dist/lib/browser/chunk-WCARAZ7J.mjs.map +0 -7
  200. package/dist/lib/browser/intent-resolver-3XYN2CBU.mjs +0 -47
  201. package/dist/lib/browser/intent-resolver-3XYN2CBU.mjs.map +0 -7
  202. package/dist/lib/browser/keyboard-QRS6WOQH.mjs.map +0 -7
  203. package/dist/lib/browser/react-surface-WURHCBQQ.mjs +0 -51
  204. package/dist/lib/browser/react-surface-WURHCBQQ.mjs.map +0 -7
  205. package/dist/lib/browser/state-54DY3DOY.mjs +0 -117
  206. package/dist/lib/browser/state-54DY3DOY.mjs.map +0 -7
  207. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  208. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  209. package/dist/types/src/capabilities/capabilities.d.ts +0 -21
  210. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  211. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  212. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  213. package/dist/types/src/capabilities/keyboard.d.ts +0 -4
  214. package/dist/types/src/capabilities/keyboard.d.ts.map +0 -1
  215. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  216. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  217. package/dist/types/src/capabilities/state.d.ts +0 -20
  218. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  219. package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts +0 -5
  220. package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +0 -1
  221. package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +0 -1
  222. package/dist/types/src/components/CommandsDialog/index.d.ts +0 -3
  223. package/dist/types/src/components/CommandsDialog/index.d.ts.map +0 -1
  224. package/dist/types/src/components/NavTreeContainer.d.ts +0 -9
  225. package/dist/types/src/components/NavTreeContainer.d.ts.map +0 -1
  226. package/dist/types/src/components/NavTreeContext.d.ts.map +0 -1
  227. package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +0 -1
  228. package/dist/types/src/events.d.ts +0 -4
  229. package/dist/types/src/events.d.ts.map +0 -1
  230. package/dist/types/src/hooks.d.ts +0 -3
  231. package/dist/types/src/hooks.d.ts.map +0 -1
  232. package/dist/types/src/types.d.ts.map +0 -1
  233. package/src/capabilities/app-graph-builder.ts +0 -52
  234. package/src/capabilities/capabilities.ts +0 -20
  235. package/src/capabilities/intent-resolver.ts +0 -37
  236. package/src/capabilities/keyboard.ts +0 -59
  237. package/src/capabilities/react-surface.tsx +0 -45
  238. package/src/capabilities/state.ts +0 -104
  239. package/src/components/CommandsDialog/CommandsDialog.tsx +0 -118
  240. package/src/components/CommandsDialog/CommandsTrigger.tsx +0 -35
  241. package/src/components/CommandsDialog/index.ts +0 -6
  242. package/src/components/NavTreeContainer.tsx +0 -313
  243. package/src/events.ts +0 -11
  244. package/src/hooks.ts +0 -21
  245. /package/dist/types/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.d.ts +0 -0
@@ -2,21 +2,23 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import React, { useCallback } from 'react';
6
6
 
7
- import { type Action, type Node } from '@dxos/app-graph';
8
- import { useTranslation, toLocalizedString, IconButton, useDensityContext } from '@dxos/react-ui';
9
- import { DropdownMenu, MenuProvider, type MenuItem } from '@dxos/react-ui-menu';
10
- import { hoverableControlItem, hoverableOpenControlItem } from '@dxos/react-ui-theme';
7
+ import { type Node } from '@dxos/app-graph';
8
+ import { useActionRunner } from '@dxos/plugin-graph';
9
+ import { IconButton, toLocalizedString, useDensityContext, useTranslation } from '@dxos/react-ui';
10
+ import { Menu, type MenuItem } from '@dxos/react-ui-menu';
11
+ import { hoverableControlItem, hoverableOpenControlItem } from '@dxos/ui-theme';
11
12
 
12
- import { NAVTREE_PLUGIN } from '../../meta';
13
+ import { meta } from '../../meta';
13
14
  import { type ActionProperties } from '../../types';
14
15
 
15
16
  export type NavTreeItemActionMenuProps = ActionProperties & {
16
- parent: Node;
17
+ parent: Node.Node;
18
+ path?: string[];
17
19
  caller?: string;
18
20
  monolithic?: boolean;
19
- menuActions?: Action[];
21
+ menuActions?: Node.Action[];
20
22
  };
21
23
 
22
24
  const fallbackIcon = 'ph--placeholder--regular';
@@ -32,40 +34,55 @@ const coarseActionButtonProps = {
32
34
 
33
35
  export const NavTreeItemActionDropdownMenu = ({
34
36
  parent,
37
+ path,
35
38
  label,
36
39
  icon,
37
40
  testId,
38
41
  menuActions,
39
42
  caller,
40
43
  }: NavTreeItemActionMenuProps) => {
41
- const { t } = useTranslation(NAVTREE_PLUGIN);
44
+ const { t } = useTranslation(meta.id);
42
45
  const density = useDensityContext();
46
+ const runAction = useActionRunner();
47
+ const handleAction = useCallback(
48
+ (action: Node.Action, params: Node.InvokeProps = {}) => runAction(action, { ...params, path }),
49
+ [runAction, path],
50
+ );
51
+
43
52
  return (
44
- <MenuProvider>
45
- <DropdownMenu.Root group={parent} items={menuActions as MenuItem[]} caller={caller}>
46
- <DropdownMenu.Trigger asChild>
47
- <IconButton
48
- {...(density === 'coarse' ? coarseActionButtonProps : fineActionButtonProps)}
49
- classNames={['shrink-0 pli-2 pointer-fine:pli-1', hoverableControlItem, hoverableOpenControlItem]}
50
- variant='ghost'
51
- icon={icon ?? fallbackIcon}
52
- iconOnly
53
- label={toLocalizedString(label, t)}
54
- data-testid={testId}
55
- />
56
- </DropdownMenu.Trigger>
57
- </DropdownMenu.Root>
58
- </MenuProvider>
53
+ <Menu.Root caller={caller} onAction={handleAction}>
54
+ <Menu.Trigger asChild>
55
+ <IconButton
56
+ {...(density === 'coarse' ? coarseActionButtonProps : fineActionButtonProps)}
57
+ classNames={['shrink-0 px-2 pointer-fine:px-1', hoverableControlItem, hoverableOpenControlItem]}
58
+ variant='ghost'
59
+ icon={icon ?? fallbackIcon}
60
+ iconOnly
61
+ label={toLocalizedString(label, t)}
62
+ data-testid={testId}
63
+ />
64
+ </Menu.Trigger>
65
+ <Menu.Content group={parent} items={menuActions as MenuItem[]} />
66
+ </Menu.Root>
59
67
  );
60
68
  };
61
69
 
62
- export const NavTreeItemMonolithicAction = ({
63
- parent,
64
- properties: { disabled, caller, testId, icon, variant = 'ghost', iconOnly = true } = { label: 'never' },
65
- data: invoke,
66
- baseLabel,
67
- }: Action & { parent: Node; onAction?: (action: Action) => void; baseLabel: string }) => {
70
+ export const NavTreeItemMonolithicAction = (
71
+ props: Node.Action & {
72
+ parent: Node.Node;
73
+ path?: string[];
74
+ onAction?: (action: Node.Action) => void;
75
+ baseLabel: string;
76
+ },
77
+ ) => {
78
+ const {
79
+ parent,
80
+ path,
81
+ properties: { disabled, caller, testId, icon, variant = 'ghost', iconOnly = true } = { label: 'never' },
82
+ baseLabel,
83
+ } = props;
68
84
  const density = useDensityContext();
85
+ const runAction = useActionRunner();
69
86
  return (
70
87
  <IconButton
71
88
  {...(density === 'coarse' ? coarseActionButtonProps : fineActionButtonProps)}
@@ -74,33 +91,40 @@ export const NavTreeItemMonolithicAction = ({
74
91
  'shrink-0',
75
92
  hoverableControlItem,
76
93
  hoverableOpenControlItem,
77
- iconOnly ? 'pli-2 pointer-fine:pli-1' : 'p-2 pointer-fine:p-2 mie-1',
94
+ iconOnly ? 'px-2 pointer-fine:px-1' : 'p-2 pointer-fine:p-2 me-1',
78
95
  ]}
79
96
  icon={icon ?? fallbackIcon}
80
97
  iconOnly={iconOnly}
81
98
  label={baseLabel}
82
99
  disabled={disabled}
83
100
  onClick={(event) => {
101
+ event.stopPropagation();
84
102
  if (disabled) {
85
103
  return;
86
104
  }
87
- event.stopPropagation();
88
- void invoke?.(caller ? { parent, caller } : { parent });
105
+
106
+ void runAction(props, caller ? { parent, caller, path } : { parent, path });
89
107
  }}
90
108
  data-testid={testId}
91
109
  />
92
110
  );
93
111
  };
94
112
 
95
- export const NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }: NavTreeItemActionMenuProps) => {
96
- const { t } = useTranslation(NAVTREE_PLUGIN);
113
+ export const NavTreeItemAction = ({
114
+ monolithic,
115
+ menuActions,
116
+ parent: node,
117
+ path,
118
+ ...props
119
+ }: NavTreeItemActionMenuProps) => {
120
+ const { t } = useTranslation(meta.id);
97
121
 
98
122
  const monolithicAction = menuActions?.length === 1 && menuActions[0];
99
123
  const baseLabel = toLocalizedString(monolithicAction ? monolithicAction.properties!.label : props.label, t);
100
124
 
101
125
  return monolithic && menuActions?.length === 1 ? (
102
- <NavTreeItemMonolithicAction baseLabel={baseLabel} parent={node} {...menuActions[0]} />
126
+ <NavTreeItemMonolithicAction baseLabel={baseLabel} parent={node} path={path} {...menuActions[0]} />
103
127
  ) : (
104
- <NavTreeItemActionDropdownMenu {...props} label={baseLabel} parent={node} menuActions={menuActions} />
128
+ <NavTreeItemActionDropdownMenu {...props} label={baseLabel} parent={node} path={path} menuActions={menuActions} />
105
129
  );
106
130
  };
@@ -2,72 +2,104 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { Fragment, memo } from 'react';
5
+ import React, { Fragment, memo, useMemo } from 'react';
6
6
 
7
- import { isAction } from '@dxos/app-graph';
8
- import { DensityProvider, Popover, toLocalizedString, Treegrid, useTranslation } from '@dxos/react-ui';
7
+ import { Node } from '@dxos/app-graph';
8
+ import { Popover, Treegrid, toLocalizedString, useTranslation } from '@dxos/react-ui';
9
9
 
10
- import { NavTreeItemAction } from './NavTreeItemAction';
11
- import { useLoadDescendents } from '../../hooks';
12
- import { NAVTREE_PLUGIN } from '../../meta';
10
+ import { useActions } from '../../hooks';
11
+ import { meta } from '../../meta';
13
12
  import { NAV_TREE_ITEM } from '../NavTree';
14
13
  import { useNavTreeContext } from '../NavTreeContext';
15
- import type { NavTreeItemColumnsProps } from '../types';
14
+ import { type NavTreeItemColumnsProps } from '../types';
16
15
 
17
- export const NavTreeItemColumns = memo(({ path, item, open, density = 'fine' }: NavTreeItemColumnsProps) => {
18
- const { t } = useTranslation(NAVTREE_PLUGIN);
19
- const { getActions, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
16
+ import { NavTreeItemAction } from './NavTreeItemAction';
20
17
 
21
- const level = path.length - 2;
18
+ export const NavTreeItemColumns = memo(({ path, item, open }: NavTreeItemColumnsProps) => {
19
+ const { t } = useTranslation(meta.id);
20
+ const { renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
22
21
 
23
- const { actions: _actions, groupedActions } = getActions(item);
24
- const [primaryAction, ...secondaryActions] = _actions.toSorted((a, b) =>
25
- a.properties?.disposition === 'list-item-primary' ? -1 : 1,
22
+ const level = path.length - 2;
23
+ const { actions: actionsProp, groupedActions } = useActions(item);
24
+ const sortedActions = useMemo(
25
+ () =>
26
+ actionsProp.toSorted((actionA, actionB) => {
27
+ const primaryA = actionA.properties?.disposition === 'list-item-primary';
28
+ const primaryB = actionB.properties?.disposition === 'list-item-primary';
29
+ if (primaryA && !primaryB) {
30
+ return -1;
31
+ }
32
+ if (primaryB && !primaryA) {
33
+ return 1;
34
+ }
35
+ return 0;
36
+ }),
37
+ [actionsProp],
26
38
  );
39
+ const [primaryAction, ...secondaryActions] = sortedActions;
27
40
 
28
- const actions = (primaryAction?.properties?.disposition === 'list-item-primary' ? secondaryActions : _actions)
29
- .flatMap((action) => (isAction(action) ? [action] : []))
30
- .filter((a) => ['list-item', 'list-item-primary'].includes(a.properties?.disposition));
41
+ const actions = useMemo(
42
+ () =>
43
+ (primaryAction?.properties?.disposition === 'list-item-primary' ? secondaryActions : sortedActions)
44
+ .flatMap((action) => (Node.isAction(action) ? [action] : []))
45
+ .filter((a) => ['list-item', 'list-item-primary'].includes(a.properties?.disposition)),
46
+ [sortedActions, primaryAction],
47
+ );
31
48
 
32
- const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
49
+ const primaryMenuActions = useMemo(
50
+ () =>
51
+ primaryAction
52
+ ? Node.isAction(primaryAction)
53
+ ? [primaryAction]
54
+ : groupedActions[primaryAction?.id ?? '']
55
+ : undefined,
56
+ [primaryAction, groupedActions],
57
+ );
33
58
 
34
- useLoadDescendents(item);
35
- useLoadDescendents(primaryAction && !isAction(primaryAction) ? primaryAction : undefined);
59
+ const ActionRoot = popoverAnchorId === `${NAV_TREE_ITEM}:${item.id}` ? Popover.Anchor : Fragment;
36
60
 
37
61
  return (
38
- <DensityProvider density={density}>
39
- <div role='none' className='contents app-no-drag'>
40
- {primaryAction?.properties?.disposition === 'list-item-primary' && !primaryAction?.properties?.disabled ? (
62
+ <div role='none' className='contents dx-app-no-drag'>
63
+ {primaryAction?.properties?.disposition === 'list-item-primary' && !primaryAction?.properties?.disabled ? (
64
+ <Treegrid.Cell classNames='contents'>
41
65
  <NavTreeItemAction
42
66
  testId={primaryAction.properties?.testId}
43
67
  label={toLocalizedString(primaryAction.properties?.label, t)}
44
68
  icon={primaryAction.properties?.icon ?? 'ph--placeholder--regular'}
45
69
  parent={item}
46
- monolithic={isAction(primaryAction)}
47
- menuActions={isAction(primaryAction) ? [primaryAction] : groupedActions[primaryAction.id]}
70
+ path={path}
71
+ monolithic={Node.isAction(primaryAction)}
72
+ menuActions={primaryMenuActions}
48
73
  menuType={primaryAction.properties?.menuType}
49
74
  caller={NAV_TREE_ITEM}
50
75
  />
51
- ) : (
52
- <Treegrid.Cell />
53
- )}
54
- <ActionRoot>
55
- {actions.length > 0 ? (
76
+ </Treegrid.Cell>
77
+ ) : (
78
+ <Treegrid.Cell role='none' />
79
+ )}
80
+ <ActionRoot>
81
+ {actions.length > 0 ? (
82
+ <Treegrid.Cell classNames='contents'>
56
83
  <NavTreeItemAction
57
84
  testId={`navtree.treeItem.actionsLevel${level}`}
58
85
  label={t('tree item actions label')}
59
86
  icon='ph--dots-three-vertical--regular'
60
87
  parent={item}
88
+ path={path}
61
89
  menuActions={actions}
62
90
  menuType='dropdown'
63
91
  caller={NAV_TREE_ITEM}
64
92
  />
65
- ) : (
66
- <Treegrid.Cell />
67
- )}
68
- </ActionRoot>
69
- {ItemEnd && <ItemEnd node={item} open={open} />}
70
- </div>
71
- </DensityProvider>
93
+ </Treegrid.Cell>
94
+ ) : (
95
+ <Treegrid.Cell role='none' />
96
+ )}
97
+ </ActionRoot>
98
+ {ItemEnd && (
99
+ <Treegrid.Cell classNames='contents'>
100
+ <ItemEnd node={item} open={open} />
101
+ </Treegrid.Cell>
102
+ )}
103
+ </div>
72
104
  );
73
105
  });