@dxos/plugin-navtree 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb
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-RSMA6I22.mjs → app-graph-builder-XGA4GPGL.mjs} +5 -4
- package/dist/lib/browser/app-graph-builder-XGA4GPGL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6YPQ625I.mjs → chunk-63YLDLLE.mjs} +178 -98
- package/dist/lib/browser/chunk-63YLDLLE.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AGQDZBPL.mjs → chunk-X2HDG62A.mjs} +3 -3
- package/dist/lib/browser/{chunk-AGQDZBPL.mjs.map → chunk-X2HDG62A.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +31 -30
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{keyboard-32EH3N4K.mjs → keyboard-46XQHY2O.mjs} +6 -5
- package/dist/lib/browser/keyboard-46XQHY2O.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-IB75DC5O.mjs → operation-resolver-NNNDII45.mjs} +8 -7
- package/dist/lib/browser/operation-resolver-NNNDII45.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-F6CVMS3Y.mjs → react-surface-APSEG23H.mjs} +10 -9
- package/dist/lib/browser/react-surface-APSEG23H.mjs.map +7 -0
- package/dist/lib/browser/{state-EVYQOUI3.mjs → state-M5YUCIQU.mjs} +6 -5
- package/dist/lib/browser/state-M5YUCIQU.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +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/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +18 -4
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -41
- package/src/NavTreePlugin.tsx +21 -23
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +4 -3
- package/src/capabilities/keyboard/keyboard.ts +5 -4
- package/src/capabilities/operation-resolver/operation-resolver.ts +5 -4
- package/src/capabilities/react-surface/react-surface.tsx +7 -6
- package/src/capabilities/state/state.ts +4 -3
- package/src/components/CommandsDialog/CommandsDialog.tsx +43 -44
- package/src/components/CommandsDialog/CommandsTrigger.tsx +3 -3
- package/src/components/NavTree/NavTree.stories.tsx +9 -8
- package/src/components/NavTreeContainer.tsx +12 -11
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +1 -1
- package/src/components/Sidebar/L0Menu.tsx +2 -5
- package/src/components/Sidebar/L1Panel.tsx +146 -67
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +1 -1
- package/src/experimental/Tree.stories.tsx +43 -49
- package/src/hooks.ts +1 -1
- package/src/types/events.ts +3 -2
- package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs.map +0 -7
- package/dist/lib/browser/chunk-6YPQ625I.mjs.map +0 -7
- package/dist/lib/browser/keyboard-32EH3N4K.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs.map +0 -7
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs.map +0 -7
- package/dist/lib/browser/state-EVYQOUI3.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.2244d791bb",
|
|
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",
|
|
@@ -33,57 +33,58 @@
|
|
|
33
33
|
"@radix-ui/react-dismissable-layer": "1.1.5",
|
|
34
34
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
35
35
|
"date-fns": "^3.3.1",
|
|
36
|
-
"@dxos/app-
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/debug": "0.8.4-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/plugin-
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-ui-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/react-ui-
|
|
36
|
+
"@dxos/app-framework": "0.8.4-main.2244d791bb",
|
|
37
|
+
"@dxos/app-toolkit": "0.8.4-main.2244d791bb",
|
|
38
|
+
"@dxos/debug": "0.8.4-main.2244d791bb",
|
|
39
|
+
"@dxos/echo": "0.8.4-main.2244d791bb",
|
|
40
|
+
"@dxos/async": "0.8.4-main.2244d791bb",
|
|
41
|
+
"@dxos/app-graph": "0.8.4-main.2244d791bb",
|
|
42
|
+
"@dxos/invariant": "0.8.4-main.2244d791bb",
|
|
43
|
+
"@dxos/keyboard": "0.8.4-main.2244d791bb",
|
|
44
|
+
"@dxos/lit-ui": "0.8.4-main.2244d791bb",
|
|
45
|
+
"@dxos/log": "0.8.4-main.2244d791bb",
|
|
46
|
+
"@dxos/operation": "0.8.4-main.2244d791bb",
|
|
47
|
+
"@dxos/plugin-deck": "0.8.4-main.2244d791bb",
|
|
48
|
+
"@dxos/plugin-graph": "0.8.4-main.2244d791bb",
|
|
49
|
+
"@dxos/plugin-observability": "0.8.4-main.2244d791bb",
|
|
50
|
+
"@dxos/react-client": "0.8.4-main.2244d791bb",
|
|
51
|
+
"@dxos/protocols": "0.8.4-main.2244d791bb",
|
|
52
|
+
"@dxos/react-ui-list": "0.8.4-main.2244d791bb",
|
|
53
|
+
"@dxos/react-ui-attention": "0.8.4-main.2244d791bb",
|
|
54
|
+
"@dxos/react-ui-menu": "0.8.4-main.2244d791bb",
|
|
55
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.2244d791bb",
|
|
56
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.2244d791bb",
|
|
57
|
+
"@dxos/react-ui-stack": "0.8.4-main.2244d791bb",
|
|
58
|
+
"@dxos/react-ui-tabs": "0.8.4-main.2244d791bb",
|
|
59
|
+
"@dxos/util": "0.8.4-main.2244d791bb"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@effect-atom/atom-react": "^0.
|
|
62
|
-
"@effect/platform": "0.
|
|
62
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
63
|
+
"@effect/platform": "0.94.4",
|
|
63
64
|
"@types/react": "~19.2.7",
|
|
64
65
|
"@types/react-dom": "~19.2.3",
|
|
65
|
-
"effect": "3.19.
|
|
66
|
+
"effect": "3.19.16",
|
|
66
67
|
"react": "~19.2.3",
|
|
67
68
|
"react-dom": "~19.2.3",
|
|
68
69
|
"vite": "7.1.9",
|
|
69
|
-
"@dxos/plugin-attention": "0.8.4-main.
|
|
70
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
71
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
72
|
-
"@dxos/plugin-testing": "0.8.4-main.
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
77
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
70
|
+
"@dxos/plugin-attention": "0.8.4-main.2244d791bb",
|
|
71
|
+
"@dxos/plugin-client": "0.8.4-main.2244d791bb",
|
|
72
|
+
"@dxos/plugin-space": "0.8.4-main.2244d791bb",
|
|
73
|
+
"@dxos/plugin-testing": "0.8.4-main.2244d791bb",
|
|
74
|
+
"@dxos/random": "0.8.4-main.2244d791bb",
|
|
75
|
+
"@dxos/plugin-theme": "0.8.4-main.2244d791bb",
|
|
76
|
+
"@dxos/react-ui": "0.8.4-main.2244d791bb",
|
|
77
|
+
"@dxos/storybook-utils": "0.8.4-main.2244d791bb",
|
|
78
|
+
"@dxos/ui-theme": "0.8.4-main.2244d791bb"
|
|
78
79
|
},
|
|
79
80
|
"peerDependencies": {
|
|
80
|
-
"@effect-atom/atom-react": "^0.
|
|
81
|
-
"@effect/platform": "0.
|
|
82
|
-
"effect": "3.19.
|
|
81
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
82
|
+
"@effect/platform": "0.94.4",
|
|
83
|
+
"effect": "3.19.16",
|
|
83
84
|
"react": "~19.2.3",
|
|
84
85
|
"react-dom": "~19.2.3",
|
|
85
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
86
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
86
|
+
"@dxos/react-ui": "0.8.4-main.2244d791bb",
|
|
87
|
+
"@dxos/ui-theme": "0.8.4-main.2244d791bb"
|
|
87
88
|
},
|
|
88
89
|
"publishConfig": {
|
|
89
90
|
"access": "public"
|
package/src/NavTreePlugin.tsx
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { ActivationEvent,
|
|
7
|
+
import { ActivationEvent, ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppActivationEvents, AppCapabilities, AppPlugin, LayoutOperation } from '@dxos/app-toolkit';
|
|
8
9
|
import { Graph } from '@dxos/plugin-graph';
|
|
9
10
|
import { type TreeData } from '@dxos/react-ui-list';
|
|
10
11
|
|
|
@@ -15,14 +16,8 @@ import { translations } from './translations';
|
|
|
15
16
|
import { NavTreeEvents } from './types';
|
|
16
17
|
|
|
17
18
|
export const NavTreePlugin = Plugin.define(meta).pipe(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
activatesOn: Common.ActivationEvent.LayoutReady,
|
|
21
|
-
activatesAfter: [NavTreeEvents.StateReady],
|
|
22
|
-
activate: State,
|
|
23
|
-
}),
|
|
24
|
-
Common.Plugin.addTranslationsModule({ translations }),
|
|
25
|
-
Common.Plugin.addMetadataModule({
|
|
19
|
+
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
20
|
+
AppPlugin.addMetadataModule({
|
|
26
21
|
metadata: {
|
|
27
22
|
id: NODE_TYPE,
|
|
28
23
|
metadata: {
|
|
@@ -39,23 +34,32 @@ export const NavTreePlugin = Plugin.define(meta).pipe(
|
|
|
39
34
|
},
|
|
40
35
|
},
|
|
41
36
|
}),
|
|
37
|
+
AppPlugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
38
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
39
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
40
|
+
Plugin.addModule({
|
|
41
|
+
id: 'state',
|
|
42
|
+
activatesOn: AppActivationEvents.LayoutReady,
|
|
43
|
+
activatesAfter: [NavTreeEvents.StateReady],
|
|
44
|
+
activate: State,
|
|
45
|
+
}),
|
|
42
46
|
Plugin.addModule({
|
|
43
47
|
id: 'expose',
|
|
44
48
|
activatesOn: ActivationEvent.allOf(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
ActivationEvents.OperationInvokerReady,
|
|
50
|
+
AppActivationEvents.AppGraphReady,
|
|
51
|
+
AppActivationEvents.LayoutReady,
|
|
48
52
|
NavTreeEvents.StateReady,
|
|
49
53
|
),
|
|
50
54
|
activate: Effect.fnUntraced(function* () {
|
|
51
|
-
const layout = yield*
|
|
52
|
-
const { invokePromise } = yield* Capability.get(
|
|
53
|
-
const { graph } = yield* Capability.get(
|
|
55
|
+
const layout = yield* Capabilities.getAtomValue(AppCapabilities.Layout);
|
|
56
|
+
const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
57
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
54
58
|
if (invokePromise && layout.active.length === 1) {
|
|
55
59
|
// TODO(wittjosiah): This should really be fired once the navtree renders for the first time.
|
|
56
60
|
// That is the point at which the graph is expanded and the path should be available.
|
|
57
61
|
void Graph.waitForPath(graph, { target: layout.active[0] }, { timeout: 30_000 })
|
|
58
|
-
.then(() => invokePromise(
|
|
62
|
+
.then(() => invokePromise(LayoutOperation.Expose, { subject: layout.active[0] }))
|
|
59
63
|
.catch(() => {});
|
|
60
64
|
}
|
|
61
65
|
|
|
@@ -64,14 +68,8 @@ export const NavTreePlugin = Plugin.define(meta).pipe(
|
|
|
64
68
|
}),
|
|
65
69
|
Plugin.addModule({
|
|
66
70
|
id: 'keyboard',
|
|
67
|
-
activatesOn: ActivationEvent.allOf(
|
|
68
|
-
Common.ActivationEvent.AppGraphReady,
|
|
69
|
-
Common.ActivationEvent.OperationInvokerReady,
|
|
70
|
-
),
|
|
71
|
+
activatesOn: ActivationEvent.allOf(AppActivationEvents.AppGraphReady, ActivationEvents.OperationInvokerReady),
|
|
71
72
|
activate: Keyboard,
|
|
72
73
|
}),
|
|
73
|
-
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
74
|
-
Common.Plugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
75
|
-
Common.Plugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
76
74
|
Plugin.make,
|
|
77
75
|
);
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { Capability
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
8
9
|
import { Operation } from '@dxos/operation';
|
|
9
10
|
import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
|
|
10
11
|
|
|
@@ -20,7 +21,7 @@ export default Capability.makeModule(
|
|
|
20
21
|
{
|
|
21
22
|
id: COMMANDS_DIALOG,
|
|
22
23
|
data: () =>
|
|
23
|
-
Operation.invoke(
|
|
24
|
+
Operation.invoke(LayoutOperation.UpdateDialog, {
|
|
24
25
|
subject: COMMANDS_DIALOG,
|
|
25
26
|
blockAlign: 'start',
|
|
26
27
|
}),
|
|
@@ -36,6 +37,6 @@ export default Capability.makeModule(
|
|
|
36
37
|
]),
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
return Capability.contributes(
|
|
40
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
40
41
|
}),
|
|
41
42
|
);
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
8
9
|
import { debounce } from '@dxos/async';
|
|
9
10
|
import { Keyboard } from '@dxos/keyboard';
|
|
10
11
|
import { Graph, Node, runAction } from '@dxos/plugin-graph';
|
|
@@ -14,8 +15,8 @@ import { KEY_BINDING } from '../../meta';
|
|
|
14
15
|
|
|
15
16
|
export default Capability.makeModule(
|
|
16
17
|
Effect.fnUntraced(function* () {
|
|
17
|
-
const { graph } = yield* Capability.get(
|
|
18
|
-
const invoker = yield* Capability.get(
|
|
18
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
19
|
+
const invoker = yield* Capability.get(Capabilities.OperationInvoker);
|
|
19
20
|
const pluginContext = yield* Capability.Service;
|
|
20
21
|
|
|
21
22
|
// TODO(wittjosiah): Factor out.
|
|
@@ -55,7 +56,7 @@ export default Capability.makeModule(
|
|
|
55
56
|
Keyboard.singleton.initialize();
|
|
56
57
|
Keyboard.singleton.setCurrentContext(Node.RootId);
|
|
57
58
|
|
|
58
|
-
return Capability.contributes(
|
|
59
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
59
60
|
Effect.sync(() => {
|
|
60
61
|
unsubscribe();
|
|
61
62
|
Keyboard.singleton.destroy();
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
8
9
|
import { log } from '@dxos/log';
|
|
9
10
|
import { OperationResolver } from '@dxos/operation';
|
|
10
11
|
import { Graph } from '@dxos/plugin-graph';
|
|
@@ -13,11 +14,11 @@ import { NavTreeCapabilities } from '../../types';
|
|
|
13
14
|
|
|
14
15
|
export default Capability.makeModule(
|
|
15
16
|
Effect.fnUntraced(function* () {
|
|
16
|
-
return Capability.contributes(
|
|
17
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
17
18
|
OperationResolver.make({
|
|
18
|
-
operation:
|
|
19
|
+
operation: LayoutOperation.Expose,
|
|
19
20
|
handler: Effect.fnUntraced(function* ({ subject }) {
|
|
20
|
-
const { graph } = yield* Capability.get(
|
|
21
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
21
22
|
const { getItem, setItem } = yield* Capability.get(NavTreeCapabilities.State);
|
|
22
23
|
yield* Effect.tryPromise(() => Graph.waitForPath(graph, { target: subject }, { timeout: 1_000 })).pipe(
|
|
23
24
|
Effect.andThen((path) => {
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
9
10
|
import { Node } from '@dxos/plugin-graph';
|
|
10
11
|
|
|
11
12
|
import { CommandsDialogContent, CommandsTrigger, NavTreeContainer, NavTreeDocumentTitle } from '../../components';
|
|
@@ -13,14 +14,14 @@ import { COMMANDS_DIALOG, meta } from '../../meta';
|
|
|
13
14
|
|
|
14
15
|
export default Capability.makeModule(() =>
|
|
15
16
|
Effect.succeed(
|
|
16
|
-
Capability.contributes(
|
|
17
|
-
|
|
17
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
18
|
+
Surface.create({
|
|
18
19
|
id: COMMANDS_DIALOG,
|
|
19
20
|
role: 'dialog',
|
|
20
21
|
filter: (data): data is { props: { selected?: string } } => data.component === COMMANDS_DIALOG,
|
|
21
22
|
component: ({ data, ref }) => <CommandsDialogContent {...data.props} ref={ref} />,
|
|
22
23
|
}),
|
|
23
|
-
|
|
24
|
+
Surface.create({
|
|
24
25
|
id: `${meta.id}/navigation`,
|
|
25
26
|
role: 'navigation',
|
|
26
27
|
filter: (data): data is { popoverAnchorId?: string; topbar: boolean; current: string } =>
|
|
@@ -36,14 +37,14 @@ export default Capability.makeModule(() =>
|
|
|
36
37
|
);
|
|
37
38
|
},
|
|
38
39
|
}),
|
|
39
|
-
|
|
40
|
+
Surface.create({
|
|
40
41
|
id: `${meta.id}/document-title`,
|
|
41
42
|
role: 'document-title',
|
|
42
43
|
component: ({ data }) => (
|
|
43
44
|
<NavTreeDocumentTitle node={Node.isGraphNode(data.subject) ? data.subject : undefined} />
|
|
44
45
|
),
|
|
45
46
|
}),
|
|
46
|
-
|
|
47
|
+
Surface.create({
|
|
47
48
|
id: `${meta.id}/search-input`,
|
|
48
49
|
role: 'search-input',
|
|
49
50
|
position: 'fallback',
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
10
|
import { Path } from '@dxos/react-ui-list';
|
|
10
11
|
|
|
11
12
|
import { meta } from '../../meta';
|
|
@@ -40,8 +41,8 @@ const getInitialState = (): Map<string, NC.NavTreeItemState> => {
|
|
|
40
41
|
|
|
41
42
|
export default Capability.makeModule(
|
|
42
43
|
Effect.fnUntraced(function* () {
|
|
43
|
-
const registry = yield* Capability.get(
|
|
44
|
-
const layoutAtom = yield* Capability.get(
|
|
44
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
45
|
+
const layoutAtom = yield* Capability.get(AppCapabilities.Layout);
|
|
45
46
|
|
|
46
47
|
// Backing state for persistence (not reactive).
|
|
47
48
|
const backingState = getInitialState();
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
9
10
|
import { Keyboard, keySymbols } from '@dxos/keyboard';
|
|
10
11
|
import { Graph, Node, useActionRunner } from '@dxos/plugin-graph';
|
|
11
12
|
import { useActions } from '@dxos/plugin-graph';
|
|
@@ -71,52 +72,50 @@ export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogCo
|
|
|
71
72
|
<Dialog.Content ref={forwardedRef}>
|
|
72
73
|
<Dialog.Title>{t('commands dialog title', { ns: meta.id })}</Dialog.Title>
|
|
73
74
|
<SearchList.Root onSearch={handleSearch}>
|
|
74
|
-
<
|
|
75
|
+
<SearchList.Content>
|
|
75
76
|
<SearchList.Input placeholder={t('command list input placeholder')} />
|
|
76
|
-
<SearchList.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
: action.properties.keyBinding?.[getHostPlatform()];
|
|
77
|
+
<SearchList.Viewport>
|
|
78
|
+
{results.map((action) => {
|
|
79
|
+
const shortcut =
|
|
80
|
+
typeof action.properties.keyBinding === 'string'
|
|
81
|
+
? action.properties.keyBinding
|
|
82
|
+
: action.properties.keyBinding?.[getHostPlatform()];
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
return (
|
|
85
|
+
<SearchList.Item
|
|
86
|
+
value={action.id}
|
|
87
|
+
key={action.id}
|
|
88
|
+
label={toLocalizedString(action.properties.label, t)}
|
|
89
|
+
icon={action.properties.icon}
|
|
90
|
+
suffix={shortcut ? keySymbols(shortcut).join('') : undefined}
|
|
91
|
+
onSelect={() => {
|
|
92
|
+
if (action.properties.disabled) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
if (Node.isActionGroup(action)) {
|
|
97
|
+
setSelected(action.id);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</div>
|
|
101
|
+
invokeSync(LayoutOperation.UpdateDialog, { state: false });
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
const node = Graph.getConnections(graph, group?.id ?? action.id, 'inbound')[0];
|
|
104
|
+
if (node && Node.isAction(action)) {
|
|
105
|
+
void runAction(action, { parent: node, caller: KEY_BINDING });
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}}
|
|
109
|
+
classNames='flex items-center gap-2'
|
|
110
|
+
disabled={action.properties.disabled}
|
|
111
|
+
{...(action.properties?.testId && {
|
|
112
|
+
'data-testid': action.properties.testId,
|
|
113
|
+
})}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
117
|
+
</SearchList.Viewport>
|
|
118
|
+
</SearchList.Content>
|
|
120
119
|
</SearchList.Root>
|
|
121
120
|
<div role='none' className='pli-cardSpacingInline pbe-cardSpacingBlock'>
|
|
122
121
|
<Dialog.Close asChild>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { Button, Icon, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
11
|
import { COMMANDS_DIALOG, meta } from '../../meta';
|
|
@@ -17,7 +17,7 @@ export const CommandsTrigger = () => {
|
|
|
17
17
|
return (
|
|
18
18
|
<Button
|
|
19
19
|
classNames='m-1 pli-1 lg:pli-2'
|
|
20
|
-
onClick={() => invokeSync(
|
|
20
|
+
onClick={() => invokeSync(LayoutOperation.UpdateDialog, { subject: COMMANDS_DIALOG, blockAlign: 'start' })}
|
|
21
21
|
>
|
|
22
22
|
<span className='text-description font-normal grow text-start'>{t('command list input placeholder')}</span>
|
|
23
23
|
<Icon icon='ph--magnifying-glass--regular' size={5} />
|
|
@@ -8,9 +8,10 @@ import * as Effect from 'effect/Effect';
|
|
|
8
8
|
import React, { type KeyboardEvent, useCallback, useRef } from 'react';
|
|
9
9
|
import { expect, userEvent, within } from 'storybook/test';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { useAtomCapability } from '@dxos/app-framework/react';
|
|
11
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
13
12
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
13
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
14
|
+
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
14
15
|
import { OperationResolver } from '@dxos/operation';
|
|
15
16
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
17
|
import { faker } from '@dxos/random';
|
|
@@ -100,7 +101,7 @@ const DefaultStory = () => {
|
|
|
100
101
|
const state = useAtomCapability(StoryState);
|
|
101
102
|
|
|
102
103
|
return (
|
|
103
|
-
<Main.Root
|
|
104
|
+
<Main.Root navigationSidebarState='expanded'>
|
|
104
105
|
<Main.NavigationSidebar label='Navigation' classNames='grid'>
|
|
105
106
|
<NavTreeContainer tab={state.tab} />
|
|
106
107
|
</Main.NavigationSidebar>
|
|
@@ -119,7 +120,7 @@ const meta = {
|
|
|
119
120
|
component: NavTreeContainer,
|
|
120
121
|
render: DefaultStory,
|
|
121
122
|
decorators: [
|
|
122
|
-
withTheme,
|
|
123
|
+
withTheme(),
|
|
123
124
|
withPluginManager({
|
|
124
125
|
plugins: [
|
|
125
126
|
...corePlugins(),
|
|
@@ -133,13 +134,13 @@ const meta = {
|
|
|
133
134
|
const storyStateAtom = Atom.make({ tab: 'space-0' }).pipe(Atom.keepAlive);
|
|
134
135
|
return [
|
|
135
136
|
Capability.contributes(StoryState, storyStateAtom),
|
|
136
|
-
Capability.contributes(
|
|
137
|
-
Capability.contributes(
|
|
137
|
+
Capability.contributes(AppCapabilities.AppGraphBuilder, storybookGraphBuilders()),
|
|
138
|
+
Capability.contributes(Capabilities.OperationResolver, [
|
|
138
139
|
OperationResolver.make({
|
|
139
|
-
operation:
|
|
140
|
+
operation: LayoutOperation.SwitchWorkspace,
|
|
140
141
|
handler: ({ subject }) =>
|
|
141
142
|
Effect.gen(function* () {
|
|
142
|
-
const registry: Registry.Registry = yield* Capability.get(
|
|
143
|
+
const registry: Registry.Registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
143
144
|
registry.set(storyStateAtom, { tab: subject });
|
|
144
145
|
}),
|
|
145
146
|
}),
|
|
@@ -6,8 +6,9 @@ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/ad
|
|
|
6
6
|
import { type Instruction, extractInstruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
|
|
7
7
|
import React, { forwardRef, memo, useCallback, useEffect, useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
+
import { useAppGraph, useLayout } from '@dxos/app-toolkit/ui';
|
|
11
12
|
import { PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
12
13
|
import { Graph, Node, useActionRunner } from '@dxos/plugin-graph';
|
|
13
14
|
import { useConnections, useActions as useGraphActions } from '@dxos/plugin-graph';
|
|
@@ -29,7 +30,7 @@ import { type NavTreeContextValue } from './types';
|
|
|
29
30
|
export const NODE_TYPE = 'dxos/app-graph/node';
|
|
30
31
|
|
|
31
32
|
const renderItemEnd = ({ node, open }: { node: Node.Node; open: boolean }) => (
|
|
32
|
-
<Surface role='navtree-item-end' data={{ id: node.id, subject: node.data, open }} limit={1} />
|
|
33
|
+
<Surface.Surface role='navtree-item-end' data={{ id: node.id, subject: node.data, open }} limit={1} />
|
|
33
34
|
);
|
|
34
35
|
|
|
35
36
|
const getChildrenFilter = (node: Node.Node): node is Node.Node =>
|
|
@@ -141,7 +142,7 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
141
142
|
|
|
142
143
|
const handleTabChange = useCallback(
|
|
143
144
|
(node: NavTreeItemGraphNode) => {
|
|
144
|
-
invokeSync(
|
|
145
|
+
invokeSync(LayoutOperation.UpdateSidebar, {
|
|
145
146
|
state:
|
|
146
147
|
node.id === tab
|
|
147
148
|
? navigationSidebarState === 'expanded'
|
|
@@ -152,13 +153,13 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
152
153
|
: 'expanded',
|
|
153
154
|
});
|
|
154
155
|
|
|
155
|
-
invokeSync(
|
|
156
|
+
invokeSync(LayoutOperation.SwitchWorkspace, { subject: node.id });
|
|
156
157
|
|
|
157
158
|
// Open the first item if the workspace is empty.
|
|
158
159
|
if (layout.active.length === 0) {
|
|
159
160
|
const [item] = getItems(graph, node).filter((node) => !Node.isActionLike(node));
|
|
160
161
|
if (item && item.data) {
|
|
161
|
-
invokeSync(
|
|
162
|
+
invokeSync(LayoutOperation.Open, { subject: [item.id] });
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
},
|
|
@@ -196,11 +197,11 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
196
197
|
|
|
197
198
|
const current = getItem(path).current;
|
|
198
199
|
if (!current) {
|
|
199
|
-
invokeSync(
|
|
200
|
+
invokeSync(LayoutOperation.Open, { subject: [node.id], key: node.properties.key });
|
|
200
201
|
} else if (option) {
|
|
201
|
-
invokeSync(
|
|
202
|
+
invokeSync(LayoutOperation.Close, { subject: [node.id] });
|
|
202
203
|
} else {
|
|
203
|
-
void invokePromise(
|
|
204
|
+
void invokePromise(LayoutOperation.ScrollIntoView, { subject: node.id });
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
const defaultAction = Graph.getActions(graph, node.id).find(
|
|
@@ -211,13 +212,13 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
if (!isLg) {
|
|
214
|
-
invokeSync(
|
|
215
|
+
invokeSync(LayoutOperation.UpdateSidebar, { state: 'closed' });
|
|
215
216
|
}
|
|
216
217
|
},
|
|
217
218
|
[graph, invokeSync, invokePromise, getItem, isLg, runAction],
|
|
218
219
|
);
|
|
219
220
|
|
|
220
|
-
const handleBack = useCallback(() => invokeSync(
|
|
221
|
+
const handleBack = useCallback(() => invokeSync(LayoutOperation.RevertWorkspace), [invokeSync]);
|
|
221
222
|
|
|
222
223
|
// TODO(wittjosiah): Factor out hook.
|
|
223
224
|
useEffect(() => {
|
|
@@ -322,7 +322,7 @@ export const L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountIte
|
|
|
322
322
|
role='none'
|
|
323
323
|
className={mx(
|
|
324
324
|
l0ItemContent,
|
|
325
|
-
'
|
|
325
|
+
'bs-[--rail-action] is-[--rail-action] group-hover/l0item:bg-hoverSurface',
|
|
326
326
|
)}
|
|
327
327
|
>
|
|
328
328
|
<Icon icon='ph--list--regular' size={5} />
|
|
@@ -334,7 +334,7 @@ export const L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountIte
|
|
|
334
334
|
</MenuProvider>
|
|
335
335
|
|
|
336
336
|
{/* Space list. */}
|
|
337
|
-
<ScrollArea.Root>
|
|
337
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
338
338
|
<ScrollArea.Viewport>
|
|
339
339
|
<div
|
|
340
340
|
role='none'
|
|
@@ -354,9 +354,6 @@ export const L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountIte
|
|
|
354
354
|
/>
|
|
355
355
|
))}
|
|
356
356
|
</div>
|
|
357
|
-
<ScrollArea.Scrollbar orientation='vertical'>
|
|
358
|
-
<ScrollArea.Thumb />
|
|
359
|
-
</ScrollArea.Scrollbar>
|
|
360
357
|
</ScrollArea.Viewport>
|
|
361
358
|
</ScrollArea.Root>
|
|
362
359
|
|