@dxos/plugin-navtree 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8
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-WEMCSQI7.mjs → chunk-ZKVY35IG.mjs} +54 -54
- package/dist/lib/browser/chunk-ZKVY35IG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -4
- 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-JSJ5SQX5.mjs → react-surface-5PZ4XJT7.mjs} +2 -2
- package/dist/lib/browser/{react-surface-JSJ5SQX5.mjs.map → react-surface-5PZ4XJT7.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 +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +25 -2
- 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/NavTreeItemAction.stories.d.ts +32 -3
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +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/L1Tabs.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +8 -4
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.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/experimental/Tree.stories.d.ts +6 -2
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/testing/app-graph-builder.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 +41 -41
- 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 +5 -5
- package/src/components/NavTreeContainer.tsx +40 -14
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +5 -4
- package/src/components/Sidebar/L0Menu.tsx +2 -2
- package/src/components/Sidebar/L1Panel.tsx +17 -19
- package/src/components/Sidebar/L1Tabs.tsx +1 -0
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +6 -4
- package/src/components/types.ts +3 -2
- package/src/experimental/Tree.stories.tsx +5 -3
- package/src/testing/app-graph-builder.ts +1 -1
- package/src/util.ts +2 -20
- package/dist/lib/browser/chunk-WEMCSQI7.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.5ea62a8",
|
|
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,9 +10,9 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
15
|
-
"source": "./src/index.ts"
|
|
15
|
+
"browser": "./dist/lib/browser/index.mjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -31,49 +31,49 @@
|
|
|
31
31
|
"@radix-ui/react-dismissable-layer": "1.1.5",
|
|
32
32
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
33
33
|
"date-fns": "^3.3.1",
|
|
34
|
-
"effect": "3.17.
|
|
35
|
-
"@dxos/app-
|
|
36
|
-
"@dxos/app-
|
|
37
|
-
"@dxos/async": "0.8.4-main.
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/echo": "0.8.4-main.
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/invariant": "0.8.4-main.
|
|
42
|
-
"@dxos/keyboard": "0.8.4-main.
|
|
43
|
-
"@dxos/live-object": "0.8.4-main.
|
|
44
|
-
"@dxos/local-storage": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/plugin-
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/react-
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-ui-list": "0.8.4-main.
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/react-ui-tabs": "0.8.4-main.
|
|
57
|
-
"@dxos/util": "0.8.4-main.
|
|
34
|
+
"effect": "3.17.7",
|
|
35
|
+
"@dxos/app-graph": "0.8.4-main.5ea62a8",
|
|
36
|
+
"@dxos/app-framework": "0.8.4-main.5ea62a8",
|
|
37
|
+
"@dxos/async": "0.8.4-main.5ea62a8",
|
|
38
|
+
"@dxos/echo": "0.8.4-main.5ea62a8",
|
|
39
|
+
"@dxos/echo-schema": "0.8.4-main.5ea62a8",
|
|
40
|
+
"@dxos/debug": "0.8.4-main.5ea62a8",
|
|
41
|
+
"@dxos/invariant": "0.8.4-main.5ea62a8",
|
|
42
|
+
"@dxos/keyboard": "0.8.4-main.5ea62a8",
|
|
43
|
+
"@dxos/live-object": "0.8.4-main.5ea62a8",
|
|
44
|
+
"@dxos/local-storage": "0.8.4-main.5ea62a8",
|
|
45
|
+
"@dxos/log": "0.8.4-main.5ea62a8",
|
|
46
|
+
"@dxos/plugin-deck": "0.8.4-main.5ea62a8",
|
|
47
|
+
"@dxos/plugin-graph": "0.8.4-main.5ea62a8",
|
|
48
|
+
"@dxos/plugin-observability": "0.8.4-main.5ea62a8",
|
|
49
|
+
"@dxos/protocols": "0.8.4-main.5ea62a8",
|
|
50
|
+
"@dxos/react-client": "0.8.4-main.5ea62a8",
|
|
51
|
+
"@dxos/react-ui-attention": "0.8.4-main.5ea62a8",
|
|
52
|
+
"@dxos/react-ui-list": "0.8.4-main.5ea62a8",
|
|
53
|
+
"@dxos/react-ui-menu": "0.8.4-main.5ea62a8",
|
|
54
|
+
"@dxos/react-ui-stack": "0.8.4-main.5ea62a8",
|
|
55
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.5ea62a8",
|
|
56
|
+
"@dxos/react-ui-tabs": "0.8.4-main.5ea62a8",
|
|
57
|
+
"@dxos/util": "0.8.4-main.5ea62a8"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@effect-rx/rx-react": "0.38.0",
|
|
61
|
-
"@effect/platform": "0.
|
|
61
|
+
"@effect/platform": "0.90.2",
|
|
62
62
|
"@types/react": "~18.2.0",
|
|
63
63
|
"@types/react-dom": "~18.2.0",
|
|
64
64
|
"react": "~18.2.0",
|
|
65
65
|
"react-dom": "~18.2.0",
|
|
66
|
-
"vite": "
|
|
67
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
68
|
-
"@dxos/plugin-attention": "0.8.4-main.
|
|
69
|
-
"@dxos/plugin-
|
|
70
|
-
"@dxos/plugin-
|
|
71
|
-
"@dxos/plugin-storybook-layout": "0.8.4-main.
|
|
72
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
73
|
-
"@dxos/random": "0.8.4-main.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
66
|
+
"vite": "7.1.1",
|
|
67
|
+
"@dxos/echo-signals": "0.8.4-main.5ea62a8",
|
|
68
|
+
"@dxos/plugin-attention": "0.8.4-main.5ea62a8",
|
|
69
|
+
"@dxos/plugin-client": "0.8.4-main.5ea62a8",
|
|
70
|
+
"@dxos/plugin-space": "0.8.4-main.5ea62a8",
|
|
71
|
+
"@dxos/plugin-storybook-layout": "0.8.4-main.5ea62a8",
|
|
72
|
+
"@dxos/plugin-theme": "0.8.4-main.5ea62a8",
|
|
73
|
+
"@dxos/random": "0.8.4-main.5ea62a8",
|
|
74
|
+
"@dxos/storybook-utils": "0.8.4-main.5ea62a8",
|
|
75
|
+
"@dxos/react-ui-theme": "0.8.4-main.5ea62a8",
|
|
76
|
+
"@dxos/react-ui": "0.8.4-main.5ea62a8"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"effect": "^3.13.3",
|
|
82
82
|
"react": "~18.2.0",
|
|
83
83
|
"react-dom": "~18.2.0",
|
|
84
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
85
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
84
|
+
"@dxos/react-ui": "0.8.4-main.5ea62a8",
|
|
85
|
+
"@dxos/react-ui-theme": "0.8.4-main.5ea62a8"
|
|
86
86
|
},
|
|
87
87
|
"publishConfig": {
|
|
88
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';
|
|
@@ -116,7 +116,7 @@ const DefaultStory = () => {
|
|
|
116
116
|
);
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
const meta
|
|
119
|
+
const meta = {
|
|
120
120
|
title: 'plugins/plugin-navtree/NavTree',
|
|
121
121
|
component: NavTreeContainer,
|
|
122
122
|
render: DefaultStory,
|
|
@@ -152,7 +152,7 @@ const meta: Meta<typeof NavTreeContainer> = {
|
|
|
152
152
|
parameters: {
|
|
153
153
|
translations,
|
|
154
154
|
},
|
|
155
|
-
}
|
|
155
|
+
} satisfies Meta<typeof NavTreeContainer>;
|
|
156
156
|
|
|
157
157
|
export default meta;
|
|
158
158
|
|
|
@@ -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
|
}),
|
|
@@ -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';
|
|
@@ -40,7 +41,9 @@ const renderItemEnd = ({ node, open }: { node: Node; open: boolean }) => (
|
|
|
40
41
|
);
|
|
41
42
|
|
|
42
43
|
const getChildrenFilter = (node: Node): node is Node =>
|
|
43
|
-
untracked(
|
|
44
|
+
untracked(
|
|
45
|
+
() => !isActionLike(node) && node.type !== PLANK_COMPANION_TYPE && node.properties.disposition !== 'hidden',
|
|
46
|
+
);
|
|
44
47
|
|
|
45
48
|
const filterItems = (node: Node, disposition?: string) => {
|
|
46
49
|
if (!disposition && (node.properties.disposition === 'hidden' || node.properties.disposition === 'alternate-tree')) {
|
|
@@ -64,6 +67,31 @@ const useItems = (node?: Node, options?: { disposition?: string; sort?: boolean
|
|
|
64
67
|
return options?.sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
65
68
|
};
|
|
66
69
|
|
|
70
|
+
const useActions = (node: Node): FlattenedActions => {
|
|
71
|
+
const { graph } = useAppGraph();
|
|
72
|
+
const actions = useGraphActions(graph, node.id);
|
|
73
|
+
|
|
74
|
+
return useMemo(
|
|
75
|
+
() =>
|
|
76
|
+
actions.reduce(
|
|
77
|
+
(acc: FlattenedActions, arg) => {
|
|
78
|
+
if (arg.properties.disposition === 'item') {
|
|
79
|
+
return acc;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
acc.actions.push(arg);
|
|
83
|
+
if (!isAction(arg)) {
|
|
84
|
+
const actionGroup = graph.getActions(arg.id);
|
|
85
|
+
acc.groupedActions[arg.id] = actionGroup;
|
|
86
|
+
}
|
|
87
|
+
return acc;
|
|
88
|
+
},
|
|
89
|
+
{ actions: [], groupedActions: {} },
|
|
90
|
+
),
|
|
91
|
+
[actions],
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
67
95
|
export type NavTreeContainerProps = {
|
|
68
96
|
popoverAnchorId?: string;
|
|
69
97
|
topbar?: boolean;
|
|
@@ -77,8 +105,6 @@ export const NavTreeContainer = memo(({ tab, popoverAnchorId, topbar }: NavTreeC
|
|
|
77
105
|
const layout = useLayout();
|
|
78
106
|
const { navigationSidebarState } = useSidebars(NAVTREE_PLUGIN);
|
|
79
107
|
|
|
80
|
-
const getActions = useCallback((node: Node) => naturalGetActions(graph, node), [graph]);
|
|
81
|
-
|
|
82
108
|
const getProps = useCallback(
|
|
83
109
|
(node: Node, path: string[]): TreeItemDataProps => {
|
|
84
110
|
const children = getChildren(graph, node, path).filter(getChildrenFilter);
|
|
@@ -269,7 +295,7 @@ export const NavTreeContainer = memo(({ tab, popoverAnchorId, topbar }: NavTreeC
|
|
|
269
295
|
() => ({
|
|
270
296
|
useItems,
|
|
271
297
|
tab,
|
|
272
|
-
|
|
298
|
+
useActions,
|
|
273
299
|
loadDescendents,
|
|
274
300
|
renderItemEnd,
|
|
275
301
|
popoverAnchorId,
|
|
@@ -287,7 +313,7 @@ export const NavTreeContainer = memo(({ tab, popoverAnchorId, topbar }: NavTreeC
|
|
|
287
313
|
}),
|
|
288
314
|
[
|
|
289
315
|
tab,
|
|
290
|
-
|
|
316
|
+
useActions,
|
|
291
317
|
loadDescendents,
|
|
292
318
|
renderItemEnd,
|
|
293
319
|
popoverAnchorId,
|
|
@@ -39,7 +39,7 @@ const menuActions = faker.helpers.multiple(
|
|
|
39
39
|
{ count: 20 },
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
const meta
|
|
42
|
+
const meta = {
|
|
43
43
|
title: 'plugins/plugin-navtree/NavTreeItemAction',
|
|
44
44
|
component: NavTreeItemAction,
|
|
45
45
|
decorators: [withTheme, withLayout()],
|
|
@@ -52,7 +52,7 @@ const meta: Meta<typeof NavTreeItemAction> = {
|
|
|
52
52
|
parameters: {
|
|
53
53
|
layout: 'centered',
|
|
54
54
|
},
|
|
55
|
-
}
|
|
55
|
+
} satisfies Meta<typeof NavTreeItemAction>;
|
|
56
56
|
|
|
57
57
|
export default meta;
|
|
58
58
|
|
|
@@ -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,21 +5,22 @@
|
|
|
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
14
|
import { type NavTreeItemColumnsProps } from '../types';
|
|
16
15
|
|
|
16
|
+
import { NavTreeItemAction } from './NavTreeItemAction';
|
|
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
|
-
const { actions: _actions, groupedActions } =
|
|
23
|
+
const { actions: _actions, groupedActions } = useActions(item);
|
|
23
24
|
const [primaryAction, ...secondaryActions] = _actions.toSorted((a, _b) =>
|
|
24
25
|
a.properties?.disposition === 'list-item-primary' ? -1 : 1,
|
|
25
26
|
);
|
|
@@ -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';
|
|
@@ -123,31 +123,29 @@ const L1PanelHeader = ({ item, path, onBack }: L1PanelProps) => {
|
|
|
123
123
|
<div className='flex is-full items-center border-be border-subduedSeparator app-drag density-coarse'>
|
|
124
124
|
<div className='is-6' />
|
|
125
125
|
<h2 className='flex-1 truncate min-is-0'>{title}</h2>
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
{(backCapable && (
|
|
127
|
+
<IconButton
|
|
128
|
+
variant='ghost'
|
|
129
|
+
icon='ph--arrow-u-down-left--regular'
|
|
130
|
+
iconOnly
|
|
131
|
+
size={5}
|
|
132
|
+
label={t('button back')}
|
|
133
|
+
classNames={[hoverableControlItem, hoverableOpenControlItem, 'pointer-fine:pli-1']}
|
|
134
|
+
onClick={handleBack}
|
|
135
|
+
/>
|
|
136
|
+
)) ||
|
|
137
|
+
(alternateTree && !isAlternate && (
|
|
128
138
|
<IconButton
|
|
139
|
+
data-testid='treeView.alternateTreeButton'
|
|
129
140
|
variant='ghost'
|
|
130
|
-
icon='ph--
|
|
141
|
+
icon={alternateTree.properties.icon ?? 'ph--placeholder--regular'}
|
|
131
142
|
iconOnly
|
|
132
143
|
size={5}
|
|
133
|
-
label={
|
|
144
|
+
label={toLocalizedString(alternateTree.properties.label ?? alternateTree.id, t)}
|
|
134
145
|
classNames={[hoverableControlItem, hoverableOpenControlItem, 'pointer-fine:pli-1']}
|
|
135
|
-
onClick={
|
|
146
|
+
onClick={handleOpen}
|
|
136
147
|
/>
|
|
137
|
-
))
|
|
138
|
-
(alternateTree && !isAlternate && (
|
|
139
|
-
<IconButton
|
|
140
|
-
data-testid='treeView.alternateTreeButton'
|
|
141
|
-
variant='ghost'
|
|
142
|
-
icon={alternateTree.properties.icon ?? 'ph--placeholder--regular'}
|
|
143
|
-
iconOnly
|
|
144
|
-
size={5}
|
|
145
|
-
label={toLocalizedString(alternateTree.properties.label ?? alternateTree.id, t)}
|
|
146
|
-
classNames={[hoverableControlItem, hoverableOpenControlItem, 'pointer-fine:pli-1']}
|
|
147
|
-
onClick={handleOpen}
|
|
148
|
-
/>
|
|
149
|
-
)) || <div />}
|
|
150
|
-
</div>
|
|
148
|
+
))}
|
|
151
149
|
<NavTreeItemColumns open path={path} item={item} density='coarse' />
|
|
152
150
|
</div>
|
|
153
151
|
);
|
|
@@ -9,6 +9,7 @@ import { type Node } from '@dxos/app-graph';
|
|
|
9
9
|
import { useLoadDescendents } from '../../hooks';
|
|
10
10
|
import { l0ItemType } from '../../util';
|
|
11
11
|
import { useNavTreeContext } from '../NavTreeContext';
|
|
12
|
+
|
|
12
13
|
import { L1Panel, type L1PanelProps } from './L1Panel';
|
|
13
14
|
|
|
14
15
|
export type L1TabsProps = Pick<L1PanelProps, 'open' | 'currentItemId' | 'onBack'> & {
|
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
|
|
9
9
|
import { withTheme } from '@dxos/storybook-utils';
|
|
10
10
|
|
|
11
11
|
import { UserAccountAvatar } from './UserAccountAvatar';
|
|
12
12
|
|
|
13
|
-
const meta
|
|
13
|
+
const meta = {
|
|
14
14
|
title: 'plugins/plugin-navtree/UserAccountAvatar',
|
|
15
15
|
component: UserAccountAvatar,
|
|
16
16
|
decorators: [withTheme],
|
|
17
|
-
}
|
|
17
|
+
} satisfies Meta<typeof UserAccountAvatar>;
|
|
18
18
|
|
|
19
19
|
export default meta;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {};
|
package/src/components/types.ts
CHANGED
|
@@ -9,9 +9,10 @@ import type { Density } from '@dxos/react-ui';
|
|
|
9
9
|
import type { TreeProps } from '@dxos/react-ui-list';
|
|
10
10
|
import type { MaybePromise } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import type { L1PanelProps } from './Sidebar';
|
|
13
12
|
import type { FlattenedActions, NavTreeItemGraphNode } from '../types';
|
|
14
13
|
|
|
14
|
+
import type { L1PanelProps } from './Sidebar';
|
|
15
|
+
|
|
15
16
|
export type NavTreeContextValue = Pick<
|
|
16
17
|
TreeProps<NavTreeItemGraphNode, { disposition?: string; sort?: boolean }>,
|
|
17
18
|
'useItems' | 'getProps' | 'isCurrent' | 'isOpen' | 'canDrop' | 'onOpenChange' | 'onSelect'
|
|
@@ -21,7 +22,7 @@ export type NavTreeContextValue = Pick<
|
|
|
21
22
|
topbar?: boolean;
|
|
22
23
|
popoverAnchorId?: string;
|
|
23
24
|
renderItemEnd?: FC<{ node: Node; open: boolean }>;
|
|
24
|
-
|
|
25
|
+
useActions: (node: Node) => FlattenedActions;
|
|
25
26
|
loadDescendents?: (node: Node) => MaybePromise<void>;
|
|
26
27
|
isAlternateTree?: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
27
28
|
setAlternateTree?: (path: string[], open: boolean) => void;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { type JSX, type PropsWithChildren, useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { faker } from '@dxos/random';
|
|
@@ -223,10 +223,12 @@ const Sidebar = ({ mutate }: { mutate?: boolean }) => {
|
|
|
223
223
|
);
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
-
const meta
|
|
226
|
+
const meta = {
|
|
227
227
|
title: 'plugins/plugin-navtree/experimental/Tree',
|
|
228
228
|
component: Tree,
|
|
229
229
|
decorators: [withTheme, withLayout({ fullscreen: true, classNames: modalSurface })],
|
|
230
|
-
}
|
|
230
|
+
} satisfies Meta<typeof Tree>;
|
|
231
231
|
|
|
232
232
|
export default meta;
|
|
233
|
+
|
|
234
|
+
type Story = StoryObj<typeof meta>;
|
|
@@ -7,7 +7,7 @@ import { Option, pipe } from 'effect';
|
|
|
7
7
|
|
|
8
8
|
import { type PluginContext } from '@dxos/app-framework';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import {
|
|
10
|
+
import { type BuilderExtensions, ROOT_ID, createExtension } from '@dxos/plugin-graph';
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
|
|
13
13
|
export const storybookGraphBuilders = (context: PluginContext): BuilderExtensions => {
|
package/src/util.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Action, type Node, type ReadableGraph,
|
|
5
|
+
import { type Action, type Node, type ReadableGraph, isActionLike } from '@dxos/app-graph';
|
|
6
6
|
import { isNonNullable } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
import { type
|
|
8
|
+
import { type NavTreeItemGraphNode } from './types';
|
|
9
9
|
|
|
10
10
|
export const getParent = (
|
|
11
11
|
graph: ReadableGraph,
|
|
@@ -88,24 +88,6 @@ export const getChildren = (
|
|
|
88
88
|
.filter(isNonNullable) as NavTreeItemGraphNode[];
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
export const getActions = (graph: ReadableGraph, node: Node): FlattenedActions => {
|
|
92
|
-
return graph.getActions(node.id).reduce(
|
|
93
|
-
(acc: FlattenedActions, arg) => {
|
|
94
|
-
if (arg.properties.disposition === 'item') {
|
|
95
|
-
return acc;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
acc.actions.push(arg);
|
|
99
|
-
if (!isAction(arg)) {
|
|
100
|
-
const actionGroup = graph.getActions(arg.id);
|
|
101
|
-
acc.groupedActions[arg.id] = actionGroup;
|
|
102
|
-
}
|
|
103
|
-
return acc;
|
|
104
|
-
},
|
|
105
|
-
{ actions: [], groupedActions: {} },
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
91
|
export const l0ItemType = (item: Node<any>) => {
|
|
110
92
|
if (item.properties.disposition === 'collection') {
|
|
111
93
|
return 'collection';
|