@dxos/plugin-navtree 0.8.4-main.b97322e → 0.8.4-main.f5c0578
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/lib/browser/{app-graph-builder-5J4LRWDX.mjs → app-graph-builder-6JDBQ25U.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-5J4LRWDX.mjs.map → app-graph-builder-6JDBQ25U.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-SICQTLXC.mjs → chunk-SNGLGBFJ.mjs} +189 -162
- package/dist/lib/browser/chunk-SNGLGBFJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-3XYN2CBU.mjs → intent-resolver-N35ZIHFD.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-3XYN2CBU.mjs.map → intent-resolver-N35ZIHFD.mjs.map} +3 -3
- package/dist/lib/browser/{keyboard-QRS6WOQH.mjs → keyboard-HMTMA33N.mjs} +1 -1
- package/dist/lib/browser/{keyboard-QRS6WOQH.mjs.map → keyboard-HMTMA33N.mjs.map} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-WURHCBQQ.mjs → react-surface-WKWXMM2N.mjs} +2 -2
- package/dist/lib/browser/{react-surface-WURHCBQQ.mjs.map → react-surface-WKWXMM2N.mjs.map} +1 -1
- package/dist/lib/browser/{state-54DY3DOY.mjs → state-P5DGL7KS.mjs} +1 -1
- package/dist/lib/browser/state-P5DGL7KS.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts +2 -2
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +5 -6
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +12 -0
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -0
- package/dist/types/src/components/Sidebar/index.d.ts +1 -0
- package/dist/types/src/components/Sidebar/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +2 -2
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -38
- package/src/NavTreePlugin.tsx +5 -5
- package/src/capabilities/app-graph-builder.ts +2 -2
- package/src/capabilities/intent-resolver.ts +1 -1
- package/src/capabilities/keyboard.ts +2 -2
- package/src/capabilities/react-surface.tsx +1 -1
- package/src/capabilities/state.ts +3 -2
- package/src/components/CommandsDialog/CommandsDialog.tsx +2 -2
- package/src/components/CommandsDialog/CommandsTrigger.tsx +1 -1
- package/src/components/NavTree/NavTree.stories.tsx +3 -3
- package/src/components/NavTree/NavTree.tsx +3 -3
- package/src/components/NavTreeContainer.tsx +37 -13
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +7 -7
- package/src/components/Sidebar/L0Menu.tsx +2 -2
- package/src/components/Sidebar/L1Panel.tsx +72 -92
- package/src/components/Sidebar/L1Tabs.tsx +58 -0
- package/src/components/Sidebar/index.ts +1 -0
- package/src/components/types.ts +3 -2
- package/src/testing/app-graph-builder.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/util.ts +2 -20
- package/dist/lib/browser/chunk-SICQTLXC.mjs.map +0 -7
- package/dist/lib/browser/state-54DY3DOY.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-navtree",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.f5c0578",
|
|
4
4
|
"description": "DXOS Surface plugin for a tree view visualization of the graph.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
16
|
}
|
|
@@ -30,49 +31,49 @@
|
|
|
30
31
|
"@radix-ui/react-dismissable-layer": "1.1.5",
|
|
31
32
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
32
33
|
"date-fns": "^3.3.1",
|
|
33
|
-
"effect": "3.17.
|
|
34
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
35
|
-
"@dxos/app-graph": "0.8.4-main.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/echo": "0.8.4-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/local-storage": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
46
|
-
"@dxos/plugin-observability": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-client": "0.8.4-main.
|
|
50
|
-
"@dxos/react-ui-
|
|
51
|
-
"@dxos/react-ui-menu": "0.8.4-main.
|
|
52
|
-
"@dxos/react-ui-stack": "0.8.4-main.
|
|
53
|
-
"@dxos/react-ui-searchlist": "0.8.4-main.
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
34
|
+
"effect": "3.17.7",
|
|
35
|
+
"@dxos/app-framework": "0.8.4-main.f5c0578",
|
|
36
|
+
"@dxos/app-graph": "0.8.4-main.f5c0578",
|
|
37
|
+
"@dxos/async": "0.8.4-main.f5c0578",
|
|
38
|
+
"@dxos/debug": "0.8.4-main.f5c0578",
|
|
39
|
+
"@dxos/echo-schema": "0.8.4-main.f5c0578",
|
|
40
|
+
"@dxos/echo": "0.8.4-main.f5c0578",
|
|
41
|
+
"@dxos/invariant": "0.8.4-main.f5c0578",
|
|
42
|
+
"@dxos/keyboard": "0.8.4-main.f5c0578",
|
|
43
|
+
"@dxos/local-storage": "0.8.4-main.f5c0578",
|
|
44
|
+
"@dxos/live-object": "0.8.4-main.f5c0578",
|
|
45
|
+
"@dxos/plugin-deck": "0.8.4-main.f5c0578",
|
|
46
|
+
"@dxos/plugin-graph": "0.8.4-main.f5c0578",
|
|
47
|
+
"@dxos/plugin-observability": "0.8.4-main.f5c0578",
|
|
48
|
+
"@dxos/log": "0.8.4-main.f5c0578",
|
|
49
|
+
"@dxos/protocols": "0.8.4-main.f5c0578",
|
|
50
|
+
"@dxos/react-client": "0.8.4-main.f5c0578",
|
|
51
|
+
"@dxos/react-ui-list": "0.8.4-main.f5c0578",
|
|
52
|
+
"@dxos/react-ui-menu": "0.8.4-main.f5c0578",
|
|
53
|
+
"@dxos/react-ui-stack": "0.8.4-main.f5c0578",
|
|
54
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.f5c0578",
|
|
55
|
+
"@dxos/react-ui-tabs": "0.8.4-main.f5c0578",
|
|
56
|
+
"@dxos/react-ui-attention": "0.8.4-main.f5c0578",
|
|
57
|
+
"@dxos/util": "0.8.4-main.f5c0578"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@effect-rx/rx-react": "0.38.0",
|
|
60
|
-
"@effect/platform": "0.
|
|
61
|
+
"@effect/platform": "0.90.2",
|
|
61
62
|
"@types/react": "~18.2.0",
|
|
62
63
|
"@types/react-dom": "~18.2.0",
|
|
63
64
|
"react": "~18.2.0",
|
|
64
65
|
"react-dom": "~18.2.0",
|
|
65
66
|
"vite": "5.4.7",
|
|
66
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
67
|
-
"@dxos/plugin-
|
|
68
|
-
"@dxos/plugin-
|
|
69
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
70
|
-
"@dxos/plugin-storybook-layout": "0.8.4-main.
|
|
71
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
67
|
+
"@dxos/echo-signals": "0.8.4-main.f5c0578",
|
|
68
|
+
"@dxos/plugin-client": "0.8.4-main.f5c0578",
|
|
69
|
+
"@dxos/plugin-attention": "0.8.4-main.f5c0578",
|
|
70
|
+
"@dxos/plugin-space": "0.8.4-main.f5c0578",
|
|
71
|
+
"@dxos/plugin-storybook-layout": "0.8.4-main.f5c0578",
|
|
72
|
+
"@dxos/plugin-theme": "0.8.4-main.f5c0578",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.f5c0578",
|
|
74
|
+
"@dxos/react-ui-theme": "0.8.4-main.f5c0578",
|
|
75
|
+
"@dxos/random": "0.8.4-main.f5c0578",
|
|
76
|
+
"@dxos/storybook-utils": "0.8.4-main.f5c0578"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
79
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -80,8 +81,8 @@
|
|
|
80
81
|
"effect": "^3.13.3",
|
|
81
82
|
"react": "~18.2.0",
|
|
82
83
|
"react-dom": "~18.2.0",
|
|
83
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
84
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
84
|
+
"@dxos/react-ui": "0.8.4-main.f5c0578",
|
|
85
|
+
"@dxos/react-ui-theme": "0.8.4-main.f5c0578"
|
|
85
86
|
},
|
|
86
87
|
"publishConfig": {
|
|
87
88
|
"access": "public"
|
package/src/NavTreePlugin.tsx
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
definePlugin,
|
|
7
|
-
defineModule,
|
|
8
|
-
Events,
|
|
9
|
-
contributes,
|
|
10
6
|
Capabilities,
|
|
7
|
+
Events,
|
|
8
|
+
LayoutAction,
|
|
11
9
|
allOf,
|
|
10
|
+
contributes,
|
|
12
11
|
createIntent,
|
|
13
|
-
|
|
12
|
+
defineModule,
|
|
13
|
+
definePlugin,
|
|
14
14
|
} from '@dxos/app-framework';
|
|
15
15
|
import { type TreeData } from '@dxos/react-ui-list';
|
|
16
16
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
6
|
import { Option, pipe } from 'effect';
|
|
7
7
|
|
|
8
|
-
import { Capabilities,
|
|
9
|
-
import {
|
|
8
|
+
import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
9
|
+
import { ROOT_ID, createExtension } from '@dxos/plugin-graph';
|
|
10
10
|
|
|
11
11
|
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, LayoutAction, type PluginContext, contributes, createResolver } from '@dxos/app-framework';
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
|
|
10
10
|
import { NavTreeCapabilities } from './capabilities';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities as AppCapabilities,
|
|
5
|
+
import { Capabilities as AppCapabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
6
6
|
import { debounce } from '@dxos/async';
|
|
7
7
|
import { Keyboard } from '@dxos/keyboard';
|
|
8
|
-
import {
|
|
8
|
+
import { type Node, isAction } from '@dxos/plugin-graph';
|
|
9
9
|
import { getHostPlatform } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
import { KEY_BINDING } from '../meta';
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
8
|
import { isGraphNode } from '@dxos/plugin-graph';
|
|
9
9
|
|
|
10
|
-
import { CommandsDialogContent, CommandsTrigger,
|
|
10
|
+
import { CommandsDialogContent, CommandsTrigger, NavTreeContainer, NavTreeDocumentTitle } from '../components';
|
|
11
11
|
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
|
|
12
12
|
|
|
13
13
|
export default () =>
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import { effect, untracked } from '@preact/signals-core';
|
|
6
6
|
|
|
7
|
-
import { Capabilities,
|
|
7
|
+
import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
8
8
|
import { type Live } from '@dxos/echo';
|
|
9
9
|
import { live } from '@dxos/live-object';
|
|
10
10
|
import { Path } from '@dxos/react-ui-list';
|
|
11
11
|
|
|
12
|
-
import { NavTreeCapabilities } from './capabilities';
|
|
13
12
|
import { NAVTREE_PLUGIN } from '../meta';
|
|
14
13
|
|
|
14
|
+
import { NavTreeCapabilities } from './capabilities';
|
|
15
|
+
|
|
15
16
|
const KEY = `${NAVTREE_PLUGIN}/state/v1`;
|
|
16
17
|
|
|
17
18
|
const getInitialState = () => {
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent, useAppGraph, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { type ActionLike, isAction, isActionGroup } from '@dxos/app-graph';
|
|
9
9
|
import { Keyboard, keySymbols } from '@dxos/keyboard';
|
|
10
10
|
import { useActions } from '@dxos/plugin-graph';
|
|
11
|
-
import { Button, Dialog, Icon,
|
|
11
|
+
import { Button, Dialog, Icon, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
13
13
|
import {
|
|
14
14
|
cardDialogContent,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { Button, Icon, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../../meta';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import { Schema } from 'effect';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
|
|
@@ -28,7 +28,7 @@ import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
|
28
28
|
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
29
29
|
import { faker } from '@dxos/random';
|
|
30
30
|
import { IconButton, Input, Main, Toolbar } from '@dxos/react-ui';
|
|
31
|
-
import {
|
|
31
|
+
import { useAttention, useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
32
32
|
import { Stack, StackItem } from '@dxos/react-ui-stack';
|
|
33
33
|
import { defaultTx, mx } from '@dxos/react-ui-theme';
|
|
34
34
|
import { withLayout } from '@dxos/storybook-utils';
|
|
@@ -172,7 +172,7 @@ export const WithClient: Story = {
|
|
|
172
172
|
AttentionPlugin(),
|
|
173
173
|
NavTreePlugin(),
|
|
174
174
|
ClientPlugin({
|
|
175
|
-
onClientInitialized: async (
|
|
175
|
+
onClientInitialized: async ({ client }) => {
|
|
176
176
|
await client.halo.createIdentity();
|
|
177
177
|
},
|
|
178
178
|
}),
|
|
@@ -10,11 +10,11 @@ import { Tabs } from '@dxos/react-ui-tabs';
|
|
|
10
10
|
import { useLoadDescendents } from '../../hooks';
|
|
11
11
|
import { type NavTreeItemGraphNode } from '../../types';
|
|
12
12
|
import { useNavTreeContext } from '../NavTreeContext';
|
|
13
|
-
import { L0Menu,
|
|
13
|
+
import { L0Menu, L1Tabs, type L1TabsProps } from '../Sidebar';
|
|
14
14
|
|
|
15
15
|
export const NAV_TREE_ITEM = 'NavTreeItem';
|
|
16
16
|
|
|
17
|
-
export type NavTreeProps = Pick<TreeProps<NavTreeItemGraphNode>, 'id' | 'root'> & Pick<
|
|
17
|
+
export type NavTreeProps = Pick<TreeProps<NavTreeItemGraphNode>, 'id' | 'root'> & Pick<L1TabsProps, 'open'>;
|
|
18
18
|
|
|
19
19
|
export const NavTree = ({ id, root, ...props }: NavTreeProps) => {
|
|
20
20
|
const { tab, useItems, onBack } = useNavTreeContext();
|
|
@@ -56,7 +56,7 @@ export const NavTree = ({ id, root, ...props }: NavTreeProps) => {
|
|
|
56
56
|
path={path}
|
|
57
57
|
parent={root}
|
|
58
58
|
/>
|
|
59
|
-
<
|
|
59
|
+
<L1Tabs topLevelItems={topLevelItems} path={path} currentItemId={tab} onBack={onBack} {...props} />
|
|
60
60
|
</Tabs.Root>
|
|
61
61
|
);
|
|
62
62
|
};
|
|
@@ -3,34 +3,35 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
6
|
-
import {
|
|
6
|
+
import { type Instruction, extractInstruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
|
|
7
7
|
import { untracked } from '@preact/signals-core';
|
|
8
8
|
import React, { memo, useCallback, useEffect, useMemo } from 'react';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
createIntent,
|
|
12
11
|
LayoutAction,
|
|
13
12
|
Surface,
|
|
13
|
+
createIntent,
|
|
14
14
|
useAppGraph,
|
|
15
15
|
useCapability,
|
|
16
16
|
useIntentDispatcher,
|
|
17
17
|
useLayout,
|
|
18
18
|
} from '@dxos/app-framework';
|
|
19
|
-
import {
|
|
19
|
+
import { type Node, ROOT_ID, type ReadableGraph, isAction, isActionLike } from '@dxos/app-graph';
|
|
20
20
|
import { PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
21
|
-
import { useConnections } from '@dxos/plugin-graph';
|
|
21
|
+
import { useConnections, useActions as useGraphActions } from '@dxos/plugin-graph';
|
|
22
22
|
import { useMediaQuery, useSidebars } from '@dxos/react-ui';
|
|
23
|
-
import {
|
|
23
|
+
import { type TreeData, type TreeItemDataProps, isTreeData } from '@dxos/react-ui-list';
|
|
24
24
|
import { mx } from '@dxos/react-ui-theme';
|
|
25
25
|
import { arrayMove, byPosition } from '@dxos/util';
|
|
26
26
|
|
|
27
|
+
import { NavTreeCapabilities } from '../capabilities';
|
|
28
|
+
import { NAVTREE_PLUGIN } from '../meta';
|
|
29
|
+
import { type FlattenedActions, type NavTreeItemGraphNode } from '../types';
|
|
30
|
+
import { getChildren, getParent, resolveMigrationOperation } from '../util';
|
|
31
|
+
|
|
27
32
|
import { NAV_TREE_ITEM, NavTree } from './NavTree';
|
|
28
33
|
import { NavTreeContext } from './NavTreeContext';
|
|
29
34
|
import { type NavTreeContextValue } from './types';
|
|
30
|
-
import { NavTreeCapabilities } from '../capabilities';
|
|
31
|
-
import { NAVTREE_PLUGIN } from '../meta';
|
|
32
|
-
import { type NavTreeItemGraphNode } from '../types';
|
|
33
|
-
import { getChildren, getParent, getActions as naturalGetActions, resolveMigrationOperation } from '../util';
|
|
34
35
|
|
|
35
36
|
// TODO(thure): Is NavTree truly authoritative in this regard?
|
|
36
37
|
export const NODE_TYPE = 'dxos/app-graph/node';
|
|
@@ -64,6 +65,31 @@ const useItems = (node?: Node, options?: { disposition?: string; sort?: boolean
|
|
|
64
65
|
return options?.sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
65
66
|
};
|
|
66
67
|
|
|
68
|
+
const useActions = (node: Node): FlattenedActions => {
|
|
69
|
+
const { graph } = useAppGraph();
|
|
70
|
+
const actions = useGraphActions(graph, node.id);
|
|
71
|
+
|
|
72
|
+
return useMemo(
|
|
73
|
+
() =>
|
|
74
|
+
actions.reduce(
|
|
75
|
+
(acc: FlattenedActions, arg) => {
|
|
76
|
+
if (arg.properties.disposition === 'item') {
|
|
77
|
+
return acc;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
acc.actions.push(arg);
|
|
81
|
+
if (!isAction(arg)) {
|
|
82
|
+
const actionGroup = graph.getActions(arg.id);
|
|
83
|
+
acc.groupedActions[arg.id] = actionGroup;
|
|
84
|
+
}
|
|
85
|
+
return acc;
|
|
86
|
+
},
|
|
87
|
+
{ actions: [], groupedActions: {} },
|
|
88
|
+
),
|
|
89
|
+
[actions],
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
67
93
|
export type NavTreeContainerProps = {
|
|
68
94
|
popoverAnchorId?: string;
|
|
69
95
|
topbar?: boolean;
|
|
@@ -77,8 +103,6 @@ export const NavTreeContainer = memo(({ tab, popoverAnchorId, topbar }: NavTreeC
|
|
|
77
103
|
const layout = useLayout();
|
|
78
104
|
const { navigationSidebarState } = useSidebars(NAVTREE_PLUGIN);
|
|
79
105
|
|
|
80
|
-
const getActions = useCallback((node: Node) => naturalGetActions(graph, node), [graph]);
|
|
81
|
-
|
|
82
106
|
const getProps = useCallback(
|
|
83
107
|
(node: Node, path: string[]): TreeItemDataProps => {
|
|
84
108
|
const children = getChildren(graph, node, path).filter(getChildrenFilter);
|
|
@@ -269,7 +293,7 @@ export const NavTreeContainer = memo(({ tab, popoverAnchorId, topbar }: NavTreeC
|
|
|
269
293
|
() => ({
|
|
270
294
|
useItems,
|
|
271
295
|
tab,
|
|
272
|
-
|
|
296
|
+
useActions,
|
|
273
297
|
loadDescendents,
|
|
274
298
|
renderItemEnd,
|
|
275
299
|
popoverAnchorId,
|
|
@@ -287,7 +311,7 @@ export const NavTreeContainer = memo(({ tab, popoverAnchorId, topbar }: NavTreeC
|
|
|
287
311
|
}),
|
|
288
312
|
[
|
|
289
313
|
tab,
|
|
290
|
-
|
|
314
|
+
useActions,
|
|
291
315
|
loadDescendents,
|
|
292
316
|
renderItemEnd,
|
|
293
317
|
popoverAnchorId,
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Action, type Node } from '@dxos/app-graph';
|
|
8
|
-
import {
|
|
9
|
-
import { DropdownMenu,
|
|
8
|
+
import { IconButton, toLocalizedString, useDensityContext, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { DropdownMenu, type MenuItem, MenuProvider } from '@dxos/react-ui-menu';
|
|
10
10
|
import { hoverableControlItem, hoverableOpenControlItem } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
12
|
import { NAVTREE_PLUGIN } from '../../meta';
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
import React, { Fragment, memo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { isAction } from '@dxos/app-graph';
|
|
8
|
-
import { DensityProvider, Popover,
|
|
8
|
+
import { DensityProvider, Popover, Treegrid, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import { NavTreeItemAction } from './NavTreeItemAction';
|
|
11
10
|
import { useLoadDescendents } from '../../hooks';
|
|
12
11
|
import { NAVTREE_PLUGIN } from '../../meta';
|
|
13
12
|
import { NAV_TREE_ITEM } from '../NavTree';
|
|
14
13
|
import { useNavTreeContext } from '../NavTreeContext';
|
|
15
|
-
import type
|
|
14
|
+
import { type NavTreeItemColumnsProps } from '../types';
|
|
15
|
+
|
|
16
|
+
import { NavTreeItemAction } from './NavTreeItemAction';
|
|
16
17
|
|
|
17
18
|
export const NavTreeItemColumns = memo(({ path, item, open, density = 'fine' }: NavTreeItemColumnsProps) => {
|
|
18
19
|
const { t } = useTranslation(NAVTREE_PLUGIN);
|
|
19
|
-
const {
|
|
20
|
+
const { useActions, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
20
21
|
|
|
21
22
|
const level = path.length - 2;
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const [primaryAction, ...secondaryActions] = _actions.toSorted((a, b) =>
|
|
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
|
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
extractClosestEdge,
|
|
13
13
|
} from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
14
14
|
import React, {
|
|
15
|
-
forwardRef,
|
|
16
15
|
type MouseEvent,
|
|
17
16
|
type PropsWithChildren,
|
|
17
|
+
forwardRef,
|
|
18
18
|
useCallback,
|
|
19
19
|
useLayoutEffect,
|
|
20
20
|
useMemo,
|
|
@@ -25,7 +25,7 @@ import React, {
|
|
|
25
25
|
import { type Node } from '@dxos/app-graph';
|
|
26
26
|
import { invariant } from '@dxos/invariant';
|
|
27
27
|
import { Icon, ListItem, ScrollArea, Tooltip, toLocalizedString, useMediaQuery, useTranslation } from '@dxos/react-ui';
|
|
28
|
-
import {
|
|
28
|
+
import { DropdownMenu, type MenuItem, MenuProvider } from '@dxos/react-ui-menu';
|
|
29
29
|
import type { StackItemRearrangeHandler } from '@dxos/react-ui-stack';
|
|
30
30
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
31
31
|
import { mx } from '@dxos/react-ui-theme';
|