@dxos/plugin-navtree 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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/NavTreePlugin-53I3ONRE.mjs +74 -0
- package/dist/lib/browser/NavTreePlugin-53I3ONRE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +28 -111
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +21 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts +1 -0
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/NavTreePlugin.node.d.ts +4 -0
- package/dist/types/src/NavTreePlugin.node.d.ts.map +1 -0
- package/dist/types/src/NavTreePlugin.test.d.ts +2 -0
- package/dist/types/src/NavTreePlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +8 -9
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +2 -2
- 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/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +0 -1
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -1
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts +8 -9
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts.map +1 -1
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.d.ts +2 -2
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLoadDescendents.d.ts.map +1 -1
- package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -1
- package/dist/types/src/hooks/useNavTreeState.d.ts +1 -5
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/expose.d.ts +1 -1
- package/dist/types/src/operations/expose.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/testing/update-state.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +8 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +1 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -40
- package/src/NavTreePlugin.node.ts +37 -0
- package/src/NavTreePlugin.test.ts +29 -0
- package/src/NavTreePlugin.tsx +4 -3
- package/src/capabilities/app-graph-builder.ts +1 -1
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +2 -3
- package/src/capabilities/state.ts +2 -2
- package/src/components/NavTree/NavTree.stories.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +3 -4
- package/src/components/Sidebar/L1Panel.tsx +82 -141
- package/src/components/types.ts +0 -1
- package/src/containers/CommandsDialogContent/CommandsDialogContent.stories.tsx +2 -1
- package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +42 -46
- package/src/containers/NavTreeContainer/NavTreeContainer.tsx +0 -9
- package/src/hooks/useNavTreeState.ts +1 -8
- package/src/index.ts +8 -2
- package/src/operations/expose.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/translations.ts +0 -1
- package/src/types/capabilities.ts +2 -2
- package/src/util.ts +1 -1
|
@@ -71,55 +71,51 @@ export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogCo
|
|
|
71
71
|
return (
|
|
72
72
|
<Dialog.Content ref={forwardedRef}>
|
|
73
73
|
<Dialog.Title srOnly>{t('commands-dialog.title', { ns: meta.id })}</Dialog.Title>
|
|
74
|
-
<
|
|
75
|
-
<SearchList.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
? action.properties.keyBinding
|
|
83
|
-
: action.properties.keyBinding?.[getHostPlatform()];
|
|
74
|
+
<SearchList.Root onSearch={handleSearch}>
|
|
75
|
+
<SearchList.Input placeholder={t('command-list-input.placeholder')} />
|
|
76
|
+
<SearchList.Viewport>
|
|
77
|
+
{results.map((action) => {
|
|
78
|
+
const shortcut =
|
|
79
|
+
typeof action.properties.keyBinding === 'string'
|
|
80
|
+
? action.properties.keyBinding
|
|
81
|
+
: action.properties.keyBinding?.[getHostPlatform()];
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
return (
|
|
84
|
+
<SearchList.Item
|
|
85
|
+
value={action.id}
|
|
86
|
+
key={action.id}
|
|
87
|
+
label={toLocalizedString(action.properties.label, t)}
|
|
88
|
+
icon={action.properties.icon}
|
|
89
|
+
suffix={shortcut ? keySymbols(shortcut).join('') : undefined}
|
|
90
|
+
onSelect={() => {
|
|
91
|
+
if (action.properties.disabled) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
96
94
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
if (Node.isActionGroup(action)) {
|
|
96
|
+
setSelected(action.id);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
101
99
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
</SearchList.Root>
|
|
122
|
-
</Dialog.Body>
|
|
100
|
+
void invokePromise(LayoutOperation.UpdateDialog, { state: false });
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
const lookupId = group?.id ?? action.id;
|
|
103
|
+
const node = Graph.getConnections(graph, lookupId, Node.actionRelation('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.Root>
|
|
123
119
|
<Dialog.ActionBar>
|
|
124
120
|
<Dialog.Close asChild>
|
|
125
121
|
<Button classNames='w-full'>{t('close.label', { ns: osTranslations })}</Button>
|
|
@@ -230,13 +230,6 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
230
230
|
});
|
|
231
231
|
}, [graph]);
|
|
232
232
|
|
|
233
|
-
const setAlternateTree = useCallback(
|
|
234
|
-
(path: string[], open: boolean) => {
|
|
235
|
-
setItem(path, 'alternateTree', open);
|
|
236
|
-
},
|
|
237
|
-
[setItem],
|
|
238
|
-
);
|
|
239
|
-
|
|
240
233
|
const onItemHover = useCallback(({ item }: { item: Node.Node }) => Graph.expand(graph, item.id, 'child'), [graph]);
|
|
241
234
|
|
|
242
235
|
const navTreeContextValue = useMemo(
|
|
@@ -247,7 +240,6 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
247
240
|
blockInstruction,
|
|
248
241
|
canDrop,
|
|
249
242
|
canSelect,
|
|
250
|
-
setAlternateTree,
|
|
251
243
|
onBack: handleBack,
|
|
252
244
|
onOpenChange: handleOpenChange,
|
|
253
245
|
onSelect: handleSelect,
|
|
@@ -260,7 +252,6 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
260
252
|
blockInstruction,
|
|
261
253
|
canDrop,
|
|
262
254
|
canSelect,
|
|
263
|
-
setAlternateTree,
|
|
264
255
|
handleBack,
|
|
265
256
|
handleOpenChange,
|
|
266
257
|
handleSelect,
|
|
@@ -12,7 +12,7 @@ import { NavTreeCapabilities } from '#types';
|
|
|
12
12
|
export type UseNavTreeStateResult = {
|
|
13
13
|
getItem: (path: string[]) => NavTreeCapabilities.NavTreeItemState;
|
|
14
14
|
getItemAtom: (path: string[]) => Atom.Atom<NavTreeCapabilities.NavTreeItemState>;
|
|
15
|
-
setItem: (path: string[], key: 'open' | 'current'
|
|
15
|
+
setItem: (path: string[], key: 'open' | 'current', next: boolean) => void;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -33,10 +33,3 @@ export const useNavTreeItemState = (path: string[]): NavTreeCapabilities.NavTree
|
|
|
33
33
|
const atom = useMemo(() => getItemAtom(path), [getItemAtom, pathKey]);
|
|
34
34
|
return useAtomValue(atom);
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Hook that subscribes to the alternateTree state for a tree item.
|
|
39
|
-
*/
|
|
40
|
-
export const useIsAlternateTree = (path: string[], _item?: any): boolean => {
|
|
41
|
-
return useNavTreeItemState(path).alternateTree ?? false;
|
|
42
|
-
};
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const NavTreePlugin = Plugin.lazy(meta, () => import('./NavTreePlugin'));
|
|
10
|
+
|
|
7
11
|
export * from './meta';
|
|
12
|
+
|
|
13
|
+
export { NavTreeCapabilities, NavTreeEvents } from './types';
|
|
8
14
|
export * from './util';
|
package/src/operations/expose.ts
CHANGED
|
@@ -7,8 +7,8 @@ import * as Option from 'effect/Option';
|
|
|
7
7
|
|
|
8
8
|
import { Capability } from '@dxos/app-framework';
|
|
9
9
|
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
10
11
|
import { log } from '@dxos/log';
|
|
11
|
-
import { Operation } from '@dxos/operation';
|
|
12
12
|
import { Graph } from '@dxos/plugin-graph';
|
|
13
13
|
import { expandAttendableId } from '@dxos/react-ui-attention';
|
|
14
14
|
|
package/src/operations/index.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -11,7 +11,6 @@ export const translations = [
|
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
13
|
'app-menu.label': 'App menu',
|
|
14
|
-
'open-settings.label': 'Settings',
|
|
15
14
|
'open-commands.label': 'Search commands',
|
|
16
15
|
'commands-dialog.title': 'Commands',
|
|
17
16
|
'command-list-input.placeholder': 'Search for commands…',
|
|
@@ -9,12 +9,12 @@ import { Capability } from '@dxos/app-framework';
|
|
|
9
9
|
import { meta } from '#meta';
|
|
10
10
|
|
|
11
11
|
export namespace NavTreeCapabilities {
|
|
12
|
-
export type NavTreeItemState = { open: boolean; current: boolean
|
|
12
|
+
export type NavTreeItemState = { open: boolean; current: boolean };
|
|
13
13
|
|
|
14
14
|
export type NavTreeStateStore = {
|
|
15
15
|
getItem: (path: string[]) => NavTreeItemState;
|
|
16
16
|
getItemAtom: (path: string[]) => Atom.Atom<NavTreeItemState>;
|
|
17
|
-
setItem: (path: string[], key: 'open' | 'current'
|
|
17
|
+
setItem: (path: string[], key: 'open' | 'current', next: boolean) => void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const State = Capability.make<NavTreeStateStore>(`${meta.id}.capability.state`);
|
package/src/util.ts
CHANGED
|
@@ -93,7 +93,7 @@ export const getChildren = (
|
|
|
93
93
|
* Determines whether a node should be visible based on its disposition.
|
|
94
94
|
*/
|
|
95
95
|
export const filterItems = (node: Node.Node, disposition?: string) => {
|
|
96
|
-
if (!disposition &&
|
|
96
|
+
if (!disposition && node.properties.disposition === 'hidden') {
|
|
97
97
|
return false;
|
|
98
98
|
} else if (!disposition) {
|
|
99
99
|
const action = Node.isAction(node);
|