@dxos/plugin-navtree 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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/index.mjs +137 -72
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +5 -0
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/NavTree/NavTree.d.ts +10 -32
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +10 -14
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/{NavTreeContext.d.ts → NavTreeContext/NavTreeContext.d.ts} +1 -1
- package/dist/types/src/components/NavTreeContext/NavTreeContext.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts +2 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +7 -3
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -1
- 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 +4 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +3 -6
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +3 -2
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +5 -13
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/{components/CommandsDialog/CommandsDialog.d.ts → containers/CommandsDialogContent/CommandsDialogContent.d.ts} +1 -1
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts +29 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts +2 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/CommandsTrigger.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts +2 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts +9 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts +3 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts +2 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- 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/hooks/index.d.ts +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useActions.d.ts +5 -0
- package/dist/types/src/hooks/useActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts +6 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts +7 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -0
- package/dist/types/src/{hooks.d.ts → hooks/useNavTreeState.d.ts} +2 -14
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/expose.d.ts +5 -0
- package/dist/types/src/operations/expose.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +3 -3
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +9 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +6 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -43
- package/src/NavTreePlugin.tsx +26 -27
- package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +10 -9
- package/src/capabilities/index.ts +11 -5
- package/src/capabilities/{keyboard/keyboard.ts → keyboard.ts} +7 -6
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +15 -15
- package/src/capabilities/{state/state.ts → state.ts} +43 -15
- package/src/components/NavTree/NavTree.stories.tsx +31 -28
- package/src/components/NavTree/NavTree.tsx +64 -22
- package/src/components/{NavTreeContext.tsx → NavTreeContext/NavTreeContext.tsx} +1 -1
- package/src/components/NavTreeContext/index.ts +5 -0
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +7 -9
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +56 -39
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +43 -17
- package/src/components/Sidebar/L0Menu.tsx +104 -113
- package/src/components/Sidebar/L1Panel.tsx +253 -94
- package/src/components/Sidebar/L1Tabs.tsx +13 -4
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +2 -3
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +1 -1
- package/src/components/index.ts +0 -3
- package/src/components/types.ts +12 -17
- package/src/containers/CommandsDialogContent/CommandsDialogContent.stories.tsx +45 -0
- package/src/{components/CommandsDialog/CommandsDialog.tsx → containers/CommandsDialogContent/CommandsDialogContent.tsx} +23 -21
- package/src/containers/CommandsDialogContent/index.ts +5 -0
- package/src/containers/CommandsTrigger/CommandsTrigger.tsx +28 -0
- package/src/containers/CommandsTrigger/index.ts +5 -0
- package/src/{components → containers/NavTreeContainer}/NavTreeContainer.tsx +85 -142
- package/src/containers/NavTreeContainer/index.ts +6 -0
- package/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.tsx +2 -2
- package/src/containers/NavTreeDocumentTitle/index.ts +5 -0
- package/src/containers/index.ts +12 -0
- package/src/experimental/Tree.stories.tsx +81 -84
- package/src/experimental/Tree.tsx +3 -3
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useActions.ts +34 -0
- package/src/hooks/useLoadDescendents.ts +23 -0
- package/src/hooks/useNavTreeModel.ts +118 -0
- package/src/{hooks.ts → hooks/useNavTreeState.ts} +3 -34
- package/src/meta.ts +2 -2
- package/src/operations/expose.ts +42 -0
- package/src/operations/index.ts +7 -0
- package/src/testing/app-graph-builder.ts +40 -36
- package/src/testing/generator.ts +25 -25
- package/src/translations.ts +9 -10
- package/src/types/capabilities.ts +2 -2
- package/src/types/events.ts +4 -3
- package/src/util.ts +19 -5
- package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs +0 -43
- package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs.map +0 -7
- package/dist/lib/browser/chunk-6YPQ625I.mjs +0 -1293
- package/dist/lib/browser/chunk-6YPQ625I.mjs.map +0 -7
- package/dist/lib/browser/chunk-AGQDZBPL.mjs +0 -23
- package/dist/lib/browser/chunk-AGQDZBPL.mjs.map +0 -7
- package/dist/lib/browser/chunk-YKTYPINZ.mjs +0 -19
- package/dist/lib/browser/chunk-YKTYPINZ.mjs.map +0 -7
- package/dist/lib/browser/keyboard-32EH3N4K.mjs +0 -52
- package/dist/lib/browser/keyboard-32EH3N4K.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs +0 -52
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs.map +0 -7
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs +0 -58
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs.map +0 -7
- package/dist/lib/browser/state-EVYQOUI3.mjs +0 -120
- package/dist/lib/browser/state-EVYQOUI3.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/keyboard/index.d.ts +0 -3
- package/dist/types/src/capabilities/keyboard/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts +0 -5
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -3
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -6
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/index.d.ts +0 -3
- package/dist/types/src/components/CommandsDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeContainer.d.ts +0 -16
- package/dist/types/src/components/NavTreeContainer.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeContext.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +0 -1
- package/dist/types/src/hooks.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/keyboard/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -41
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/components/CommandsDialog/CommandsTrigger.tsx +0 -26
- package/src/components/CommandsDialog/index.ts +0 -6
- /package/dist/types/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.d.ts +0 -0
- /package/dist/types/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.d.ts +0 -0
|
@@ -2,150 +2,309 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
import React, { memo, useCallback, useMemo } from 'react';
|
|
6
8
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
+
import { Node } from '@dxos/app-graph';
|
|
10
|
+
import { isPinnedWorkspace } from '@dxos/app-toolkit';
|
|
11
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { Graph, useActionRunner, useConnections, useEdges } from '@dxos/plugin-graph';
|
|
13
|
+
import { DensityProvider, IconButton, ScrollArea, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { useAttended } from '@dxos/react-ui-attention';
|
|
9
15
|
import { Tree } from '@dxos/react-ui-list';
|
|
16
|
+
import { Menu, type MenuItem } from '@dxos/react-ui-menu';
|
|
10
17
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
11
18
|
import { hoverableControlItem, hoverableOpenControlItem } from '@dxos/ui-theme';
|
|
12
19
|
|
|
13
|
-
import { useIsAlternateTree } from '
|
|
14
|
-
import { meta } from '
|
|
20
|
+
import { useActions, useIsAlternateTree, useLoadDescendents } from '#hooks';
|
|
21
|
+
import { meta } from '#meta';
|
|
22
|
+
|
|
23
|
+
import { NAV_TREE_ITEM } from '../NavTree';
|
|
15
24
|
import { useNavTreeContext } from '../NavTreeContext';
|
|
16
|
-
import { NavTreeItemColumns } from '../NavTreeItem';
|
|
25
|
+
import { NavTreeItemAction, NavTreeItemColumns } from '../NavTreeItem';
|
|
17
26
|
|
|
18
27
|
export type L1PanelProps = {
|
|
19
28
|
open?: boolean;
|
|
20
29
|
path: string[];
|
|
21
30
|
item: Node.Node;
|
|
22
|
-
|
|
31
|
+
isCurrent: boolean;
|
|
23
32
|
onBack?: () => void;
|
|
24
33
|
};
|
|
25
34
|
|
|
26
35
|
/**
|
|
27
36
|
* Space or settings panel.
|
|
28
37
|
*/
|
|
29
|
-
|
|
38
|
+
const L1Panel$ = ({ open, path, item, isCurrent, onBack }: L1PanelProps) => {
|
|
30
39
|
const { t } = useTranslation(meta.id);
|
|
31
|
-
const navTreeContext = useNavTreeContext();
|
|
32
40
|
const title = toLocalizedString(item.properties.label, t);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const { useItems } = navTreeContext;
|
|
36
|
-
const alternateTree = useItems(item, { disposition: 'alternate-tree' })[0];
|
|
37
|
-
const alternatePath = useMemo(() => [...path, item.id], [item.id, path]);
|
|
38
|
-
const isAlternate = useIsAlternateTree(alternatePath, item);
|
|
39
|
-
const useAlternateItems = useCallback(
|
|
40
|
-
(node?: Node.Node, { disposition }: { disposition?: string } = {}) => {
|
|
41
|
-
// TODO(wittjosiah): Sorting is expensive, limit to necessary items for now.
|
|
42
|
-
return useItems(node, { disposition, sort: node?.id === alternateTree.id });
|
|
43
|
-
},
|
|
44
|
-
[alternateTree, useItems],
|
|
45
|
-
);
|
|
41
|
+
const isActivated = useIsActivatedWorkspace(item);
|
|
42
|
+
const shouldRenderContent = isCurrent || isActivated;
|
|
46
43
|
|
|
47
44
|
return (
|
|
48
|
-
<Tabs.
|
|
45
|
+
<Tabs.Panel
|
|
49
46
|
key={item.id}
|
|
50
47
|
value={item.id}
|
|
51
48
|
classNames={[
|
|
52
|
-
'absolute inset-
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
|
|
49
|
+
'absolute inset-y-0 end-0',
|
|
50
|
+
'w-[calc(100%-var(--dx-l0-size))] lg:w-(--dx-l1-size) grid-cols-1 grid-rows-[var(--dx-rail-size)_1fr]',
|
|
51
|
+
'py-[env(safe-area-inset-top)]',
|
|
52
|
+
isCurrent && 'grid',
|
|
56
53
|
]}
|
|
57
54
|
tabIndex={-1}
|
|
58
55
|
aria-label={title}
|
|
56
|
+
{...(isCurrent && { 'data-testid': 'navtree.workspace.visible' })}
|
|
59
57
|
{...(!open && { inert: true })}
|
|
60
58
|
>
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
<L1PanelHeader path={path} item={item} currentItemId={currentItemId} onBack={onBack} />
|
|
64
|
-
<div role='none' className='overflow-y-auto'>
|
|
65
|
-
{isAlternate ? (
|
|
66
|
-
<Tree
|
|
67
|
-
{...navTreeContext}
|
|
68
|
-
id={alternateTree.id}
|
|
69
|
-
root={alternateTree}
|
|
70
|
-
path={alternatePath}
|
|
71
|
-
levelOffset={5}
|
|
72
|
-
gridTemplateColumns='[tree-row-start] 1fr min-content min-content min-content [tree-row-end]'
|
|
73
|
-
renderColumns={NavTreeItemColumns}
|
|
74
|
-
useItems={useAlternateItems}
|
|
75
|
-
/>
|
|
76
|
-
) : (
|
|
77
|
-
<Tree
|
|
78
|
-
{...navTreeContext}
|
|
79
|
-
id={item.id}
|
|
80
|
-
root={item}
|
|
81
|
-
path={path}
|
|
82
|
-
levelOffset={5}
|
|
83
|
-
gridTemplateColumns='[tree-row-start] 1fr min-content min-content min-content [tree-row-end]'
|
|
84
|
-
renderColumns={NavTreeItemColumns}
|
|
85
|
-
draggable
|
|
86
|
-
/>
|
|
87
|
-
)}
|
|
88
|
-
</div>
|
|
89
|
-
</DensityProvider>
|
|
90
|
-
)}
|
|
91
|
-
</Tabs.Tabpanel>
|
|
59
|
+
{shouldRenderContent && <L1PanelContent open={open} path={path} item={item} onBack={onBack} />}
|
|
60
|
+
</Tabs.Panel>
|
|
92
61
|
);
|
|
93
62
|
};
|
|
94
63
|
|
|
64
|
+
/** Determines whether a workspace tab has been populated with real child content (i.e. expanded at least once). */
|
|
65
|
+
const useIsActivatedWorkspace = (item: Node.Node): boolean => {
|
|
66
|
+
const { graph } = useAppGraph();
|
|
67
|
+
const edges = useEdges(graph, item.id);
|
|
68
|
+
|
|
69
|
+
return useMemo(() => {
|
|
70
|
+
const childIds = edges[Graph.relationKey('child')] ?? [];
|
|
71
|
+
return childIds.some((childId) => {
|
|
72
|
+
const child = Graph.getNode(graph, childId);
|
|
73
|
+
if (Option.isNone(child)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return child.value.properties.disposition === undefined;
|
|
77
|
+
});
|
|
78
|
+
}, [edges, graph]);
|
|
79
|
+
};
|
|
80
|
+
|
|
95
81
|
/**
|
|
96
|
-
*
|
|
82
|
+
* Mounted panel content for active or previously-visited tabs.
|
|
97
83
|
*/
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
const { setAlternateTree, ...navTreeContext } = useNavTreeContext();
|
|
101
|
-
const title = toLocalizedString(item.properties.label, t);
|
|
84
|
+
const L1PanelContent = ({ path, item, onBack }: Pick<L1PanelProps, 'open' | 'path' | 'item' | 'onBack'>) => {
|
|
85
|
+
const navTreeContext = useNavTreeContext();
|
|
102
86
|
|
|
103
|
-
|
|
104
|
-
const alternateTree = navTreeContext.useItems(item, { disposition: 'alternate-tree' })[0];
|
|
87
|
+
const alternateTree = useAlternateTreeItem(item);
|
|
105
88
|
const alternatePath = useMemo(() => [...path, item.id], [item.id, path]);
|
|
106
89
|
const isAlternate = useIsAlternateTree(alternatePath, item);
|
|
107
|
-
const backCapable = item.id.startsWith('!') || isAlternate;
|
|
108
90
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
91
|
+
return (
|
|
92
|
+
<DensityProvider density='fine'>
|
|
93
|
+
<L1PanelHeader path={path} item={item} onBack={onBack} />
|
|
94
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
95
|
+
<ScrollArea.Viewport>
|
|
96
|
+
{isAlternate && alternateTree ? (
|
|
97
|
+
<Tree
|
|
98
|
+
model={navTreeContext.model}
|
|
99
|
+
id={alternateTree.id}
|
|
100
|
+
rootId={alternateTree.id}
|
|
101
|
+
path={alternatePath}
|
|
102
|
+
levelOffset={5}
|
|
103
|
+
gridTemplateColumns='[tree-row-start] 1fr min-content min-content min-content [tree-row-end]'
|
|
104
|
+
renderColumns={NavTreeItemColumns}
|
|
105
|
+
blockInstruction={navTreeContext.blockInstruction}
|
|
106
|
+
canDrop={navTreeContext.canDrop}
|
|
107
|
+
canSelect={navTreeContext.canSelect}
|
|
108
|
+
onOpenChange={navTreeContext.onOpenChange}
|
|
109
|
+
onSelect={navTreeContext.onSelect}
|
|
110
|
+
onItemHover={navTreeContext.onItemHover}
|
|
111
|
+
/>
|
|
112
|
+
) : (
|
|
113
|
+
<Tree
|
|
114
|
+
model={navTreeContext.model}
|
|
115
|
+
id={item.id}
|
|
116
|
+
rootId={item.id}
|
|
117
|
+
path={path}
|
|
118
|
+
levelOffset={5}
|
|
119
|
+
gridTemplateColumns='[tree-row-start] 1fr min-content min-content min-content [tree-row-end]'
|
|
120
|
+
draggable
|
|
121
|
+
renderColumns={NavTreeItemColumns}
|
|
122
|
+
blockInstruction={navTreeContext.blockInstruction}
|
|
123
|
+
canDrop={navTreeContext.canDrop}
|
|
124
|
+
canSelect={navTreeContext.canSelect}
|
|
125
|
+
onOpenChange={navTreeContext.onOpenChange}
|
|
126
|
+
onSelect={navTreeContext.onSelect}
|
|
127
|
+
onItemHover={navTreeContext.onItemHover}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
130
|
+
</ScrollArea.Viewport>
|
|
131
|
+
</ScrollArea.Root>
|
|
132
|
+
</DensityProvider>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Header row.
|
|
138
|
+
*/
|
|
139
|
+
const L1PanelHeader = ({ item, path, onBack }: Pick<L1PanelProps, 'item' | 'path' | 'onBack'>) => {
|
|
140
|
+
const { t } = useTranslation(meta.id);
|
|
141
|
+
const { renderItemEnd: ItemEnd } = useNavTreeContext();
|
|
142
|
+
const title = toLocalizedString(item.properties.label, t);
|
|
143
|
+
const backCapableWorkspace = isPinnedWorkspace(item.id);
|
|
144
|
+
|
|
145
|
+
const { primaryAction, groupedActions, menuActions, onAction } = useL1MenuActions({ item, path });
|
|
146
|
+
useLoadDescendents(item);
|
|
112
147
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
148
|
+
// TODO(wittjosiah): Hack to only show containsAttended when attended item is within alternate tree (e.g. settings).
|
|
149
|
+
// Since every object in the space is a descendant of the space node, we'd otherwise always show containsAttended.
|
|
150
|
+
const alternateTree = useAlternateTreeItem(item);
|
|
151
|
+
const attended = useAttended();
|
|
152
|
+
const alternateTreeOpen = useMemo(() => {
|
|
153
|
+
if (!alternateTree) {
|
|
154
|
+
return true;
|
|
118
155
|
}
|
|
119
|
-
|
|
156
|
+
const hasAlternateAttended = attended.some(
|
|
157
|
+
(attendedId) => attendedId === alternateTree.id || attendedId.startsWith(alternateTree.id + '/'),
|
|
158
|
+
);
|
|
159
|
+
return !hasAlternateAttended;
|
|
160
|
+
}, [alternateTree, attended]);
|
|
120
161
|
|
|
121
|
-
// TODO(burdon): Reuse same grid as tree?
|
|
122
162
|
return (
|
|
123
|
-
<div
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
163
|
+
<div
|
|
164
|
+
data-tauri-drag-region
|
|
165
|
+
className='flex w-full items-center border-b border-subdued-separator dx-app-drag dx-density-coarse pe-1'
|
|
166
|
+
>
|
|
167
|
+
{backCapableWorkspace ? (
|
|
127
168
|
<IconButton
|
|
128
|
-
|
|
169
|
+
density='coarse'
|
|
170
|
+
classNames={['shrink-0 px-2 pointer-fine:px-1', hoverableControlItem, hoverableOpenControlItem]}
|
|
129
171
|
variant='ghost'
|
|
130
|
-
icon='ph--
|
|
172
|
+
icon='ph--caret-left--regular'
|
|
131
173
|
iconOnly
|
|
132
|
-
label={t('button
|
|
133
|
-
|
|
134
|
-
onClick={
|
|
174
|
+
label={t('button-back.button')}
|
|
175
|
+
data-testid='treeView.primaryTreeButton'
|
|
176
|
+
onClick={() => onBack?.()}
|
|
135
177
|
/>
|
|
136
|
-
)
|
|
137
|
-
|
|
178
|
+
) : (
|
|
179
|
+
<div data-tauri-drag-region className='w-6' />
|
|
180
|
+
)}
|
|
181
|
+
<h2 data-tauri-drag-region className='flex-1 truncate min-w-0'>
|
|
182
|
+
{title}
|
|
183
|
+
</h2>
|
|
184
|
+
{/* TODO(wittjosiah): Reconcile with NavTreeItemColumns. */}
|
|
185
|
+
<div role='none' className='contents dx-app-no-drag'>
|
|
186
|
+
{primaryAction?.properties?.disposition === 'list-item-primary' && !primaryAction?.properties?.disabled && (
|
|
187
|
+
<NavTreeItemAction
|
|
188
|
+
testId={primaryAction.properties?.testId}
|
|
189
|
+
label={toLocalizedString(primaryAction.properties?.label, t)}
|
|
190
|
+
icon={primaryAction.properties?.icon ?? 'ph--placeholder--regular'}
|
|
191
|
+
parent={item}
|
|
192
|
+
path={path}
|
|
193
|
+
monolithic={Node.isAction(primaryAction)}
|
|
194
|
+
menuActions={Node.isAction(primaryAction) ? [primaryAction] : groupedActions[primaryAction?.id ?? '']}
|
|
195
|
+
menuType={primaryAction.properties?.menuType}
|
|
196
|
+
caller={NAV_TREE_ITEM}
|
|
197
|
+
/>
|
|
198
|
+
)}
|
|
199
|
+
{menuActions.length === 1 && (
|
|
138
200
|
<IconButton
|
|
139
|
-
|
|
201
|
+
density='coarse'
|
|
202
|
+
classNames={['shrink-0 px-2 pointer-fine:px-1', hoverableControlItem, hoverableOpenControlItem]}
|
|
140
203
|
variant='ghost'
|
|
141
|
-
icon={
|
|
204
|
+
icon={menuActions[0].properties?.icon ?? 'ph--placeholder--regular'}
|
|
142
205
|
iconOnly
|
|
143
|
-
label={toLocalizedString(
|
|
144
|
-
|
|
145
|
-
onClick={
|
|
206
|
+
label={toLocalizedString(menuActions[0].properties?.label, t)}
|
|
207
|
+
data-testid={menuActions[0].properties?.testId}
|
|
208
|
+
onClick={() => onAction(menuActions[0] as Node.Action)}
|
|
146
209
|
/>
|
|
147
|
-
)
|
|
148
|
-
|
|
210
|
+
)}
|
|
211
|
+
{menuActions.length > 1 && (
|
|
212
|
+
<Menu.Root caller={NAV_TREE_ITEM} onAction={onAction}>
|
|
213
|
+
<Menu.Trigger asChild>
|
|
214
|
+
<IconButton
|
|
215
|
+
density='coarse'
|
|
216
|
+
classNames={['shrink-0 px-2 pointer-fine:px-1', hoverableControlItem, hoverableOpenControlItem]}
|
|
217
|
+
variant='ghost'
|
|
218
|
+
icon='ph--dots-three-vertical--regular'
|
|
219
|
+
iconOnly
|
|
220
|
+
label={t('tree-item-actions.label')}
|
|
221
|
+
data-testid='navtree.treeItem.actionsLevel0'
|
|
222
|
+
/>
|
|
223
|
+
</Menu.Trigger>
|
|
224
|
+
<Menu.Content group={item} items={menuActions as MenuItem[]} />
|
|
225
|
+
</Menu.Root>
|
|
226
|
+
)}
|
|
227
|
+
{ItemEnd && <ItemEnd node={item} open={alternateTreeOpen} />}
|
|
228
|
+
</div>
|
|
149
229
|
</div>
|
|
150
230
|
);
|
|
151
231
|
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Builds the menu actions for the L1 panel header, combining graph actions with a synthetic settings/back action.
|
|
235
|
+
*/
|
|
236
|
+
const useL1MenuActions = ({ item, path }: Pick<L1PanelProps, 'item' | 'path'>) => {
|
|
237
|
+
const { t } = useTranslation(meta.id);
|
|
238
|
+
const { setAlternateTree } = useNavTreeContext();
|
|
239
|
+
const { graph } = useAppGraph();
|
|
240
|
+
const runAction = useActionRunner();
|
|
241
|
+
|
|
242
|
+
const alternateTree = useAlternateTreeItem(item);
|
|
243
|
+
const alternatePath = useMemo(() => [...path, item.id], [item.id, path]);
|
|
244
|
+
const isAlternate = useIsAlternateTree(alternatePath, item);
|
|
245
|
+
|
|
246
|
+
// Graph actions.
|
|
247
|
+
const { actions: actionsProp, groupedActions } = useActions(item);
|
|
248
|
+
const [primaryAction, ...secondaryActions] = actionsProp.toSorted((a, _b) =>
|
|
249
|
+
a.properties?.disposition === 'list-item-primary' ? -1 : 1,
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
const graphMenuActions = (
|
|
253
|
+
primaryAction?.properties?.disposition === 'list-item-primary' ? secondaryActions : actionsProp
|
|
254
|
+
)
|
|
255
|
+
.flatMap((action) => (Node.isAction(action) ? [action] : []))
|
|
256
|
+
.filter((a) => ['list-item', 'list-item-primary'].includes(a.properties?.disposition));
|
|
257
|
+
|
|
258
|
+
// Synthetic settings/back action.
|
|
259
|
+
const settingsActionId = `${item.id}~settings`;
|
|
260
|
+
const settingsAction = useMemo((): Node.Action | undefined => {
|
|
261
|
+
if (!alternateTree) {
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
id: settingsActionId,
|
|
266
|
+
type: Node.ActionType,
|
|
267
|
+
data: () => Effect.void,
|
|
268
|
+
properties: {
|
|
269
|
+
label: isAlternate
|
|
270
|
+
? ['button-back.button', { ns: meta.id }]
|
|
271
|
+
: (alternateTree.properties.label ?? alternateTree.id),
|
|
272
|
+
icon: isAlternate
|
|
273
|
+
? 'ph--arrow-u-down-left--regular'
|
|
274
|
+
: (alternateTree.properties.icon ?? 'ph--placeholder--regular'),
|
|
275
|
+
disposition: 'list-item',
|
|
276
|
+
testId: isAlternate ? 'navtree.backToSpace' : 'navtree.spaceSettings',
|
|
277
|
+
},
|
|
278
|
+
} as Node.Action;
|
|
279
|
+
}, [alternateTree, isAlternate, settingsActionId, t]);
|
|
280
|
+
|
|
281
|
+
const menuActions = useMemo(
|
|
282
|
+
() => [...graphMenuActions, ...(settingsAction ? [settingsAction] : [])],
|
|
283
|
+
[graphMenuActions, settingsAction],
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
const onAction = useCallback(
|
|
287
|
+
(action: Node.Action, params?: Node.InvokeProps) => {
|
|
288
|
+
if (action.id === settingsActionId) {
|
|
289
|
+
if (alternateTree && !isAlternate) {
|
|
290
|
+
Graph.expand(graph, alternateTree.id, 'child');
|
|
291
|
+
}
|
|
292
|
+
setAlternateTree?.(alternatePath, !isAlternate);
|
|
293
|
+
} else {
|
|
294
|
+
void runAction(action, { ...params, path });
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
[settingsActionId, setAlternateTree, alternatePath, isAlternate, runAction, graph, alternateTree, path],
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
return { primaryAction, groupedActions, menuActions, onAction };
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
/** Finds the first child with disposition 'alternate-tree' using graph connections directly. */
|
|
304
|
+
const useAlternateTreeItem = (item: Node.Node): Node.Node | undefined => {
|
|
305
|
+
const { graph } = useAppGraph();
|
|
306
|
+
const connections = useConnections(graph, item.id, 'child');
|
|
307
|
+
return connections.find((node) => node.properties.disposition === 'alternate-tree');
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export const L1Panel = memo(L1Panel$);
|
|
@@ -7,10 +7,10 @@ import React from 'react';
|
|
|
7
7
|
import { type Node } from '@dxos/app-graph';
|
|
8
8
|
|
|
9
9
|
import { l0ItemType } from '../../util';
|
|
10
|
-
|
|
11
10
|
import { L1Panel, type L1PanelProps } from './L1Panel';
|
|
12
11
|
|
|
13
|
-
export type L1TabsProps = Pick<L1PanelProps, 'open' | '
|
|
12
|
+
export type L1TabsProps = Pick<L1PanelProps, 'open' | 'onBack'> & {
|
|
13
|
+
currentItemId: string;
|
|
14
14
|
path: string[];
|
|
15
15
|
topLevelItems: Node.Node[];
|
|
16
16
|
};
|
|
@@ -18,13 +18,22 @@ export type L1TabsProps = Pick<L1PanelProps, 'open' | 'currentItemId' | 'onBack'
|
|
|
18
18
|
/**
|
|
19
19
|
* Each workspace is an L1 tab.
|
|
20
20
|
*/
|
|
21
|
-
export const L1Tabs = ({ topLevelItems, onBack,
|
|
21
|
+
export const L1Tabs = ({ topLevelItems, currentItemId, onBack, open, path }: L1TabsProps) => {
|
|
22
22
|
return (
|
|
23
23
|
<>
|
|
24
24
|
{topLevelItems.map((item) => {
|
|
25
25
|
const type = l0ItemType(item);
|
|
26
26
|
if (type === 'tab') {
|
|
27
|
-
return
|
|
27
|
+
return (
|
|
28
|
+
<L1Panel
|
|
29
|
+
key={item.id}
|
|
30
|
+
item={item}
|
|
31
|
+
path={path}
|
|
32
|
+
open={open}
|
|
33
|
+
onBack={onBack}
|
|
34
|
+
isCurrent={item.id === currentItemId}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
28
37
|
}
|
|
29
38
|
return null;
|
|
30
39
|
})}
|
|
@@ -9,9 +9,8 @@ import { withTheme } from '@dxos/react-ui/testing';
|
|
|
9
9
|
import { UserAccountAvatar } from './UserAccountAvatar';
|
|
10
10
|
|
|
11
11
|
const meta = {
|
|
12
|
-
title: 'plugins/plugin-navtree/UserAccountAvatar',
|
|
13
|
-
|
|
14
|
-
decorators: [withTheme],
|
|
12
|
+
title: 'plugins/plugin-navtree/components/UserAccountAvatar',
|
|
13
|
+
decorators: [withTheme()],
|
|
15
14
|
component: UserAccountAvatar,
|
|
16
15
|
} satisfies Meta<typeof UserAccountAvatar>;
|
|
17
16
|
|
|
@@ -22,7 +22,7 @@ export const UserAccountAvatar = ({ size, userId, hue, emoji, status }: UserAcco
|
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<>
|
|
25
|
-
<L0ItemActiveTabIndicator classNames='inset-
|
|
25
|
+
<L0ItemActiveTabIndicator classNames='inset-y-6' />
|
|
26
26
|
<div
|
|
27
27
|
className='grid place-items-center dx-focus-ring-group-indicator rounded-full'
|
|
28
28
|
data-joyride='welcome/account'
|
package/src/components/index.ts
CHANGED
package/src/components/types.ts
CHANGED
|
@@ -6,28 +6,23 @@ import type { FC } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type Node } from '@dxos/app-graph';
|
|
8
8
|
import type { Density } from '@dxos/react-ui';
|
|
9
|
-
import type { TreeProps } from '@dxos/react-ui-list';
|
|
10
|
-
import type { MaybePromise } from '@dxos/util';
|
|
9
|
+
import type { TreeModel, TreeProps } from '@dxos/react-ui-list';
|
|
11
10
|
|
|
12
|
-
import type {
|
|
11
|
+
import type { NavTreeItemGraphNode } from '#types';
|
|
13
12
|
|
|
14
13
|
import type { L1PanelProps } from './Sidebar';
|
|
15
14
|
|
|
16
|
-
export type NavTreeContextValue =
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export type NavTreeContextValue = {
|
|
16
|
+
model: TreeModel<NavTreeItemGraphNode>;
|
|
17
|
+
popoverAnchorId?: string;
|
|
18
|
+
renderItemEnd?: FC<{ node: Node.Node; open: boolean }>;
|
|
19
|
+
setAlternateTree?: (path: string[], open: boolean) => void;
|
|
20
|
+
onTabChange?: (node: NavTreeItemGraphNode) => void;
|
|
21
|
+
} & Pick<
|
|
22
|
+
TreeProps<NavTreeItemGraphNode>,
|
|
23
|
+
'blockInstruction' | 'canDrop' | 'canSelect' | 'onOpenChange' | 'onSelect' | 'onItemHover'
|
|
19
24
|
> &
|
|
20
|
-
Pick<L1PanelProps, 'onBack'
|
|
21
|
-
tab: string;
|
|
22
|
-
topbar?: boolean;
|
|
23
|
-
popoverAnchorId?: string;
|
|
24
|
-
renderItemEnd?: FC<{ node: Node.Node; open: boolean }>;
|
|
25
|
-
useActions: (node: Node.Node) => FlattenedActions;
|
|
26
|
-
loadDescendents?: (node: Node.Node) => MaybePromise<void>;
|
|
27
|
-
useIsAlternateTree?: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
28
|
-
setAlternateTree?: (path: string[], open: boolean) => void;
|
|
29
|
-
onTabChange?: (node: NavTreeItemGraphNode) => void;
|
|
30
|
-
};
|
|
25
|
+
Pick<L1PanelProps, 'onBack'>;
|
|
31
26
|
|
|
32
27
|
export type NavTreeItemColumnsProps = {
|
|
33
28
|
path: string[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
10
|
+
import { Dialog } from '@dxos/react-ui';
|
|
11
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
12
|
+
|
|
13
|
+
import { NavTreePlugin } from '../../NavTreePlugin';
|
|
14
|
+
import { translations } from '../../translations';
|
|
15
|
+
import { CommandsDialogContent } from './CommandsDialogContent';
|
|
16
|
+
|
|
17
|
+
const DefaultStory = () => (
|
|
18
|
+
<Dialog.Root defaultOpen>
|
|
19
|
+
<Dialog.Overlay>
|
|
20
|
+
<CommandsDialogContent />
|
|
21
|
+
</Dialog.Overlay>
|
|
22
|
+
</Dialog.Root>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const meta = {
|
|
26
|
+
title: 'plugins/plugin-navtree/containers/CommandsDialogContent',
|
|
27
|
+
component: CommandsDialogContent,
|
|
28
|
+
render: DefaultStory,
|
|
29
|
+
decorators: [
|
|
30
|
+
withLayout({ layout: 'fullscreen' }),
|
|
31
|
+
withPluginManager({
|
|
32
|
+
plugins: [...corePlugins(), StorybookPlugin({}), NavTreePlugin()],
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
parameters: {
|
|
36
|
+
layout: 'fullscreen',
|
|
37
|
+
translations,
|
|
38
|
+
},
|
|
39
|
+
} satisfies Meta<typeof CommandsDialogContent>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
|
|
43
|
+
type Story = StoryObj<typeof meta>;
|
|
44
|
+
|
|
45
|
+
export const Default: Story = {};
|
|
@@ -4,17 +4,18 @@
|
|
|
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';
|
|
12
13
|
import { Button, Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
13
|
-
import { SearchList, useSearchListResults } from '@dxos/react-ui-
|
|
14
|
+
import { SearchList, useSearchListResults } from '@dxos/react-ui-search';
|
|
14
15
|
import { osTranslations } from '@dxos/ui-theme';
|
|
15
16
|
import { getHostPlatform } from '@dxos/util';
|
|
16
17
|
|
|
17
|
-
import { KEY_BINDING, meta } from '
|
|
18
|
+
import { KEY_BINDING, meta } from '#meta';
|
|
18
19
|
|
|
19
20
|
export type CommandsDialogContentProps = {
|
|
20
21
|
selected?: string;
|
|
@@ -24,7 +25,7 @@ export type CommandsDialogContentProps = {
|
|
|
24
25
|
export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogContentProps>(
|
|
25
26
|
({ selected: initial }, forwardedRef) => {
|
|
26
27
|
const { t } = useTranslation(meta.id);
|
|
27
|
-
const {
|
|
28
|
+
const { invokePromise } = useOperationInvoker();
|
|
28
29
|
const runAction = useActionRunner();
|
|
29
30
|
const { graph } = useAppGraph();
|
|
30
31
|
const [selected, setSelected] = useState<string | undefined>(initial);
|
|
@@ -37,12 +38,12 @@ export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogCo
|
|
|
37
38
|
const actionMap = new Set<string>();
|
|
38
39
|
const actions: Node.ActionLike[] = [];
|
|
39
40
|
Graph.traverse(graph, {
|
|
41
|
+
relation: ['child', 'action'],
|
|
40
42
|
visitor: (node, path) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
) {
|
|
43
|
+
const isActionLike = Node.isAction(node) || Node.isActionGroup(node);
|
|
44
|
+
const parentId = path.at(-2) ?? '';
|
|
45
|
+
const matches = current === parentId || current.startsWith(parentId + '/');
|
|
46
|
+
if (isActionLike && !actionMap.has(node.id) && matches) {
|
|
46
47
|
actionMap.add(node.id);
|
|
47
48
|
actions.push(node);
|
|
48
49
|
}
|
|
@@ -69,11 +70,11 @@ export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogCo
|
|
|
69
70
|
|
|
70
71
|
return (
|
|
71
72
|
<Dialog.Content ref={forwardedRef}>
|
|
72
|
-
<Dialog.Title>{t('commands
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
<SearchList.Input placeholder={t('command list input placeholder')} />
|
|
73
|
+
<Dialog.Title srOnly>{t('commands-dialog.title', { ns: meta.id })}</Dialog.Title>
|
|
74
|
+
<Dialog.Body>
|
|
75
|
+
<SearchList.Root onSearch={handleSearch}>
|
|
76
76
|
<SearchList.Content>
|
|
77
|
+
<SearchList.Input placeholder={t('command-list-input.placeholder')} />
|
|
77
78
|
<SearchList.Viewport>
|
|
78
79
|
{results.map((action) => {
|
|
79
80
|
const shortcut =
|
|
@@ -98,9 +99,10 @@ export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogCo
|
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
|
|
102
|
+
void invokePromise(LayoutOperation.UpdateDialog, { state: false });
|
|
102
103
|
setTimeout(() => {
|
|
103
|
-
const
|
|
104
|
+
const lookupId = group?.id ?? action.id;
|
|
105
|
+
const node = Graph.getConnections(graph, lookupId, Node.actionRelation('inbound'))[0];
|
|
104
106
|
if (node && Node.isAction(action)) {
|
|
105
107
|
void runAction(action, { parent: node, caller: KEY_BINDING });
|
|
106
108
|
}
|
|
@@ -116,13 +118,13 @@ export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogCo
|
|
|
116
118
|
})}
|
|
117
119
|
</SearchList.Viewport>
|
|
118
120
|
</SearchList.Content>
|
|
119
|
-
</
|
|
120
|
-
</
|
|
121
|
-
<
|
|
121
|
+
</SearchList.Root>
|
|
122
|
+
</Dialog.Body>
|
|
123
|
+
<Dialog.ActionBar>
|
|
122
124
|
<Dialog.Close asChild>
|
|
123
|
-
<Button classNames='
|
|
125
|
+
<Button classNames='w-full'>{t('close.label', { ns: osTranslations })}</Button>
|
|
124
126
|
</Dialog.Close>
|
|
125
|
-
</
|
|
127
|
+
</Dialog.ActionBar>
|
|
126
128
|
</Dialog.Content>
|
|
127
129
|
);
|
|
128
130
|
},
|