@dxos/plugin-navtree 0.8.4-main.b97322e → 0.8.4-main.bc674ce

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 (184) hide show
  1. package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs +43 -0
  2. package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-6YPQ625I.mjs +1293 -0
  4. package/dist/lib/browser/chunk-6YPQ625I.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-AGQDZBPL.mjs +23 -0
  6. package/dist/lib/browser/chunk-AGQDZBPL.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-YKTYPINZ.mjs +19 -0
  8. package/dist/lib/browser/chunk-YKTYPINZ.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +84 -96
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/{keyboard-QRS6WOQH.mjs → keyboard-32EH3N4K.mjs} +20 -19
  12. package/dist/lib/browser/keyboard-32EH3N4K.mjs.map +7 -0
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/operation-resolver-IB75DC5O.mjs +52 -0
  15. package/dist/lib/browser/operation-resolver-IB75DC5O.mjs.map +7 -0
  16. package/dist/lib/browser/react-surface-F6CVMS3Y.mjs +58 -0
  17. package/dist/lib/browser/react-surface-F6CVMS3Y.mjs.map +7 -0
  18. package/dist/lib/browser/state-EVYQOUI3.mjs +120 -0
  19. package/dist/lib/browser/state-EVYQOUI3.mjs.map +7 -0
  20. package/dist/types/src/NavTreePlugin.d.ts +2 -1
  21. package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  23. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  24. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  25. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/index.d.ts +5 -105
  27. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/keyboard/index.d.ts +3 -0
  29. package/dist/types/src/capabilities/keyboard/index.d.ts.map +1 -0
  30. package/dist/types/src/capabilities/keyboard/keyboard.d.ts +5 -0
  31. package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  33. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  35. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  37. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  39. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/state/index.d.ts +3 -0
  41. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/state/state.d.ts +6 -0
  43. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  44. package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts +3 -2
  45. package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +1 -1
  46. package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +1 -1
  47. package/dist/types/src/components/NavTree/NavTree.d.ts +32 -3
  48. package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
  49. package/dist/types/src/components/NavTree/NavTree.stories.d.ts +29 -4
  50. package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
  51. package/dist/types/src/components/NavTreeContainer.d.ts +8 -1
  52. package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
  53. package/dist/types/src/components/NavTreeDocumentTitle.d.ts +1 -1
  54. package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +1 -1
  55. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +6 -6
  56. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
  57. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +33 -4
  58. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
  59. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +2 -2
  60. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
  61. package/dist/types/src/components/Sidebar/L0Menu.d.ts +6 -4
  62. package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
  63. package/dist/types/src/components/Sidebar/L1Panel.d.ts +5 -6
  64. package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
  65. package/dist/types/src/components/Sidebar/L1Tabs.d.ts +12 -0
  66. package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -0
  67. package/dist/types/src/components/Sidebar/index.d.ts +1 -0
  68. package/dist/types/src/components/Sidebar/index.d.ts.map +1 -1
  69. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
  70. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +8 -5
  71. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
  72. package/dist/types/src/components/index.d.ts.map +1 -1
  73. package/dist/types/src/components/types.d.ts +8 -8
  74. package/dist/types/src/components/types.d.ts.map +1 -1
  75. package/dist/types/src/experimental/Tree.d.ts +1 -2
  76. package/dist/types/src/experimental/Tree.d.ts.map +1 -1
  77. package/dist/types/src/experimental/Tree.stories.d.ts +7 -4
  78. package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
  79. package/dist/types/src/hooks.d.ts +32 -1
  80. package/dist/types/src/hooks.d.ts.map +1 -1
  81. package/dist/types/src/index.d.ts +1 -2
  82. package/dist/types/src/index.d.ts.map +1 -1
  83. package/dist/types/src/meta.d.ts +3 -4
  84. package/dist/types/src/meta.d.ts.map +1 -1
  85. package/dist/types/src/testing/app-graph-builder.d.ts +2 -3
  86. package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
  87. package/dist/types/src/testing/generator.d.ts +5 -6
  88. package/dist/types/src/testing/generator.d.ts.map +1 -1
  89. package/dist/types/src/testing/update-state.d.ts +2 -2
  90. package/dist/types/src/testing/update-state.d.ts.map +1 -1
  91. package/dist/types/src/translations.d.ts +1 -0
  92. package/dist/types/src/translations.d.ts.map +1 -1
  93. package/dist/types/src/types/capabilities.d.ts +16 -0
  94. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  95. package/dist/types/src/types/events.d.ts +5 -0
  96. package/dist/types/src/types/events.d.ts.map +1 -0
  97. package/dist/types/src/types/index.d.ts +4 -0
  98. package/dist/types/src/types/index.d.ts.map +1 -0
  99. package/dist/types/src/{types.d.ts → types/schema.d.ts} +10 -9
  100. package/dist/types/src/types/schema.d.ts.map +1 -0
  101. package/dist/types/src/util.d.ts +8 -9
  102. package/dist/types/src/util.d.ts.map +1 -1
  103. package/dist/types/tsconfig.tsbuildinfo +1 -1
  104. package/package.json +55 -53
  105. package/src/NavTreePlugin.tsx +65 -83
  106. package/src/capabilities/app-graph-builder/app-graph-builder.ts +41 -0
  107. package/src/capabilities/app-graph-builder/index.ts +7 -0
  108. package/src/capabilities/index.ts +5 -9
  109. package/src/capabilities/keyboard/index.ts +7 -0
  110. package/src/capabilities/keyboard/keyboard.ts +65 -0
  111. package/src/capabilities/operation-resolver/index.ts +7 -0
  112. package/src/capabilities/operation-resolver/operation-resolver.ts +41 -0
  113. package/src/capabilities/react-surface/index.ts +7 -0
  114. package/src/capabilities/react-surface/react-surface.tsx +54 -0
  115. package/src/capabilities/state/index.ts +7 -0
  116. package/src/capabilities/state/state.ts +121 -0
  117. package/src/components/CommandsDialog/CommandsDialog.tsx +109 -98
  118. package/src/components/CommandsDialog/CommandsTrigger.tsx +6 -15
  119. package/src/components/NavTree/NavTree.stories.tsx +98 -93
  120. package/src/components/NavTree/NavTree.tsx +12 -18
  121. package/src/components/NavTreeContainer.tsx +280 -256
  122. package/src/components/NavTreeDocumentTitle.tsx +5 -4
  123. package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +20 -12
  124. package/src/components/NavTreeItem/NavTreeItemAction.tsx +25 -18
  125. package/src/components/NavTreeItem/NavTreeItemColumns.tsx +38 -32
  126. package/src/components/Sidebar/L0Menu.tsx +114 -139
  127. package/src/components/Sidebar/L1Panel.tsx +76 -99
  128. package/src/components/Sidebar/L1Tabs.tsx +33 -0
  129. package/src/components/Sidebar/index.ts +1 -0
  130. package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +9 -8
  131. package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
  132. package/src/components/index.ts +1 -0
  133. package/src/components/types.ts +9 -8
  134. package/src/experimental/Tree.stories.tsx +28 -30
  135. package/src/experimental/Tree.tsx +7 -24
  136. package/src/hooks.ts +54 -2
  137. package/src/index.ts +1 -2
  138. package/src/meta.ts +11 -8
  139. package/src/testing/app-graph-builder.ts +159 -234
  140. package/src/testing/generator.ts +20 -18
  141. package/src/testing/update-state.ts +6 -6
  142. package/src/translations.ts +1 -0
  143. package/src/types/capabilities.ts +21 -0
  144. package/src/types/events.ts +11 -0
  145. package/src/types/index.ts +7 -0
  146. package/src/{types.ts → types/schema.ts} +9 -8
  147. package/src/util.ts +14 -35
  148. package/dist/lib/browser/app-graph-builder-5J4LRWDX.mjs +0 -45
  149. package/dist/lib/browser/app-graph-builder-5J4LRWDX.mjs.map +0 -7
  150. package/dist/lib/browser/chunk-ERDGQTH5.mjs +0 -16
  151. package/dist/lib/browser/chunk-ERDGQTH5.mjs.map +0 -7
  152. package/dist/lib/browser/chunk-SICQTLXC.mjs +0 -1442
  153. package/dist/lib/browser/chunk-SICQTLXC.mjs.map +0 -7
  154. package/dist/lib/browser/chunk-WCARAZ7J.mjs +0 -15
  155. package/dist/lib/browser/chunk-WCARAZ7J.mjs.map +0 -7
  156. package/dist/lib/browser/intent-resolver-3XYN2CBU.mjs +0 -47
  157. package/dist/lib/browser/intent-resolver-3XYN2CBU.mjs.map +0 -7
  158. package/dist/lib/browser/keyboard-QRS6WOQH.mjs.map +0 -7
  159. package/dist/lib/browser/react-surface-WURHCBQQ.mjs +0 -51
  160. package/dist/lib/browser/react-surface-WURHCBQQ.mjs.map +0 -7
  161. package/dist/lib/browser/state-54DY3DOY.mjs +0 -117
  162. package/dist/lib/browser/state-54DY3DOY.mjs.map +0 -7
  163. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  164. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  165. package/dist/types/src/capabilities/capabilities.d.ts +0 -21
  166. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  167. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  168. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  169. package/dist/types/src/capabilities/keyboard.d.ts +0 -4
  170. package/dist/types/src/capabilities/keyboard.d.ts.map +0 -1
  171. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  172. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  173. package/dist/types/src/capabilities/state.d.ts +0 -20
  174. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  175. package/dist/types/src/events.d.ts +0 -4
  176. package/dist/types/src/events.d.ts.map +0 -1
  177. package/dist/types/src/types.d.ts.map +0 -1
  178. package/src/capabilities/app-graph-builder.ts +0 -52
  179. package/src/capabilities/capabilities.ts +0 -20
  180. package/src/capabilities/intent-resolver.ts +0 -37
  181. package/src/capabilities/keyboard.ts +0 -59
  182. package/src/capabilities/react-surface.tsx +0 -45
  183. package/src/capabilities/state.ts +0 -104
  184. package/src/events.ts +0 -11
@@ -5,13 +5,14 @@ import { useEffect } from 'react';
5
5
 
6
6
  import { type Node } from '@dxos/app-graph';
7
7
  import { toLocalizedString, useTranslation } from '@dxos/react-ui';
8
+ import { osTranslations } from '@dxos/ui-theme';
8
9
 
9
- import { NAVTREE_PLUGIN } from '../meta';
10
+ import { meta } from '../meta';
10
11
 
11
- export const NavTreeDocumentTitle = ({ node }: { node?: Node }) => {
12
- const { t } = useTranslation(NAVTREE_PLUGIN);
12
+ export const NavTreeDocumentTitle = ({ node }: { node?: Node.Node }) => {
13
+ const { t } = useTranslation(meta.id);
13
14
  useEffect(() => {
14
- document.title = node ? toLocalizedString(node.properties.label, t) : t('current app name', { ns: 'appkit' });
15
+ document.title = node ? toLocalizedString(node.properties.label, t) : t('current app name', { ns: osTranslations });
15
16
  }, [node?.properties?.label]);
16
17
  return null;
17
18
  };
@@ -2,13 +2,15 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import * as Effect from 'effect/Effect';
8
7
 
9
- import { type NodeArg } from '@dxos/app-graph';
8
+ import { RuntimePlugin } from '@dxos/app-framework';
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
+ import { type Node } from '@dxos/app-graph';
11
+ import { corePlugins } from '@dxos/plugin-testing';
10
12
  import { faker } from '@dxos/random';
11
- import { withLayout, withTheme } from '@dxos/storybook-utils';
13
+ import { withTheme } from '@dxos/react-ui/testing';
12
14
 
13
15
  import { NavTreeItemAction, type NavTreeItemActionMenuProps } from './NavTreeItemAction';
14
16
 
@@ -20,7 +22,7 @@ const parent = {
20
22
  label: faker.lorem.words(2),
21
23
  icon: 'ph--circle--regular',
22
24
  },
23
- } satisfies NodeArg<any>;
25
+ } satisfies Node.NodeArg<any>;
24
26
 
25
27
  // TODO(burdon): Factor out across tests.
26
28
  const menuActions = faker.helpers.multiple(
@@ -28,31 +30,37 @@ const menuActions = faker.helpers.multiple(
28
30
  ({
29
31
  id: faker.string.uuid(),
30
32
  type: 'action',
31
- data: () => {
32
- console.log('invoke');
33
- },
33
+ data: () =>
34
+ Effect.sync(() => {
35
+ console.log('invoke');
36
+ }),
34
37
  properties: {
35
38
  label: faker.lorem.words(2),
36
39
  icon: 'ph--circle--regular',
37
40
  },
38
- }) satisfies NodeArg<any>,
41
+ }) satisfies Node.NodeArg<any>,
39
42
  { count: 20 },
40
43
  );
41
44
 
42
- const meta: Meta<typeof NavTreeItemAction> = {
45
+ const meta = {
43
46
  title: 'plugins/plugin-navtree/NavTreeItemAction',
44
47
  component: NavTreeItemAction,
45
- decorators: [withTheme, withLayout()],
46
48
  args: {
47
49
  icon: 'ph--list--regular',
48
50
  parent,
49
51
  menuActions,
50
52
  label: 'Select action',
51
53
  } satisfies Partial<NavTreeItemActionMenuProps>,
54
+ decorators: [
55
+ withTheme,
56
+ withPluginManager({
57
+ plugins: [...corePlugins(), RuntimePlugin()],
58
+ }),
59
+ ],
52
60
  parameters: {
53
61
  layout: 'centered',
54
62
  },
55
- };
63
+ } satisfies Meta<typeof NavTreeItemAction>;
56
64
 
57
65
  export default meta;
58
66
 
@@ -4,19 +4,20 @@
4
4
 
5
5
  import React 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 { DropdownMenu, type MenuItem, MenuProvider } 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;
17
18
  caller?: string;
18
19
  monolithic?: boolean;
19
- menuActions?: Action[];
20
+ menuActions?: Node.Action[];
20
21
  };
21
22
 
22
23
  const fallbackIcon = 'ph--placeholder--regular';
@@ -38,10 +39,12 @@ export const NavTreeItemActionDropdownMenu = ({
38
39
  menuActions,
39
40
  caller,
40
41
  }: NavTreeItemActionMenuProps) => {
41
- const { t } = useTranslation(NAVTREE_PLUGIN);
42
+ const { t } = useTranslation(meta.id);
42
43
  const density = useDensityContext();
44
+ const runAction = useActionRunner();
45
+
43
46
  return (
44
- <MenuProvider>
47
+ <MenuProvider onAction={runAction}>
45
48
  <DropdownMenu.Root group={parent} items={menuActions as MenuItem[]} caller={caller}>
46
49
  <DropdownMenu.Trigger asChild>
47
50
  <IconButton
@@ -59,13 +62,16 @@ export const NavTreeItemActionDropdownMenu = ({
59
62
  );
60
63
  };
61
64
 
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 }) => {
65
+ export const NavTreeItemMonolithicAction = (
66
+ props: Node.Action & { parent: Node.Node; onAction?: (action: Node.Action) => void; baseLabel: string },
67
+ ) => {
68
+ const {
69
+ parent,
70
+ properties: { disabled, caller, testId, icon, variant = 'ghost', iconOnly = true } = { label: 'never' },
71
+ baseLabel,
72
+ } = props;
68
73
  const density = useDensityContext();
74
+ const runAction = useActionRunner();
69
75
  return (
70
76
  <IconButton
71
77
  {...(density === 'coarse' ? coarseActionButtonProps : fineActionButtonProps)}
@@ -81,11 +87,12 @@ export const NavTreeItemMonolithicAction = ({
81
87
  label={baseLabel}
82
88
  disabled={disabled}
83
89
  onClick={(event) => {
90
+ event.stopPropagation();
84
91
  if (disabled) {
85
92
  return;
86
93
  }
87
- event.stopPropagation();
88
- void invoke?.(caller ? { parent, caller } : { parent });
94
+
95
+ void runAction(props, caller ? { parent, caller } : { parent });
89
96
  }}
90
97
  data-testid={testId}
91
98
  />
@@ -93,7 +100,7 @@ export const NavTreeItemMonolithicAction = ({
93
100
  };
94
101
 
95
102
  export const NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }: NavTreeItemActionMenuProps) => {
96
- const { t } = useTranslation(NAVTREE_PLUGIN);
103
+ const { t } = useTranslation(meta.id);
97
104
 
98
105
  const monolithicAction = menuActions?.length === 1 && menuActions[0];
99
106
  const baseLabel = toLocalizedString(monolithicAction ? monolithicAction.properties!.label : props.label, t);
@@ -4,55 +4,57 @@
4
4
 
5
5
  import React, { Fragment, memo } 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
10
  import { useLoadDescendents } from '../../hooks';
12
- import { NAVTREE_PLUGIN } from '../../meta';
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 { useActions, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
22
21
 
23
- const { actions: _actions, groupedActions } = getActions(item);
24
- const [primaryAction, ...secondaryActions] = _actions.toSorted((a, b) =>
22
+ const level = path.length - 2;
23
+ const { actions: _actions, groupedActions } = useActions(item);
24
+ const [primaryAction, ...secondaryActions] = _actions.toSorted((a, _b) =>
25
25
  a.properties?.disposition === 'list-item-primary' ? -1 : 1,
26
26
  );
27
27
 
28
28
  const actions = (primaryAction?.properties?.disposition === 'list-item-primary' ? secondaryActions : _actions)
29
- .flatMap((action) => (isAction(action) ? [action] : []))
29
+ .flatMap((action) => (Node.isAction(action) ? [action] : []))
30
30
  .filter((a) => ['list-item', 'list-item-primary'].includes(a.properties?.disposition));
31
31
 
32
- const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
33
-
34
32
  useLoadDescendents(item);
35
- useLoadDescendents(primaryAction && !isAction(primaryAction) ? primaryAction : undefined);
33
+ useLoadDescendents(primaryAction && !Node.isAction(primaryAction) ? (primaryAction as Node.Node) : undefined);
34
+
35
+ const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
36
36
 
37
37
  return (
38
- <DensityProvider density={density}>
39
- <div role='none' className='contents app-no-drag'>
40
- {primaryAction?.properties?.disposition === 'list-item-primary' && !primaryAction?.properties?.disabled ? (
38
+ <div role='none' className='contents app-no-drag'>
39
+ {primaryAction?.properties?.disposition === 'list-item-primary' && !primaryAction?.properties?.disabled ? (
40
+ <Treegrid.Cell classNames='contents'>
41
41
  <NavTreeItemAction
42
42
  testId={primaryAction.properties?.testId}
43
43
  label={toLocalizedString(primaryAction.properties?.label, t)}
44
44
  icon={primaryAction.properties?.icon ?? 'ph--placeholder--regular'}
45
45
  parent={item}
46
- monolithic={isAction(primaryAction)}
47
- menuActions={isAction(primaryAction) ? [primaryAction] : groupedActions[primaryAction.id]}
46
+ monolithic={Node.isAction(primaryAction)}
47
+ menuActions={Node.isAction(primaryAction) ? [primaryAction] : groupedActions[primaryAction?.id ?? '']}
48
48
  menuType={primaryAction.properties?.menuType}
49
49
  caller={NAV_TREE_ITEM}
50
50
  />
51
- ) : (
52
- <Treegrid.Cell />
53
- )}
54
- <ActionRoot>
55
- {actions.length > 0 ? (
51
+ </Treegrid.Cell>
52
+ ) : (
53
+ <Treegrid.Cell role='none' />
54
+ )}
55
+ <ActionRoot>
56
+ {actions.length > 0 ? (
57
+ <Treegrid.Cell classNames='contents'>
56
58
  <NavTreeItemAction
57
59
  testId={`navtree.treeItem.actionsLevel${level}`}
58
60
  label={t('tree item actions label')}
@@ -62,12 +64,16 @@ export const NavTreeItemColumns = memo(({ path, item, open, density = 'fine' }:
62
64
  menuType='dropdown'
63
65
  caller={NAV_TREE_ITEM}
64
66
  />
65
- ) : (
66
- <Treegrid.Cell />
67
- )}
68
- </ActionRoot>
69
- {ItemEnd && <ItemEnd node={item} open={open} />}
70
- </div>
71
- </DensityProvider>
67
+ </Treegrid.Cell>
68
+ ) : (
69
+ <Treegrid.Cell role='none' />
70
+ )}
71
+ </ActionRoot>
72
+ {ItemEnd && (
73
+ <Treegrid.Cell classNames='contents'>
74
+ <ItemEnd node={item} open={open} />
75
+ </Treegrid.Cell>
76
+ )}
77
+ </div>
72
78
  );
73
79
  });