@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.
Files changed (86) hide show
  1. package/dist/lib/browser/NavTreePlugin-53I3ONRE.mjs +74 -0
  2. package/dist/lib/browser/NavTreePlugin-53I3ONRE.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +28 -111
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/translations.mjs +21 -0
  7. package/dist/lib/browser/translations.mjs.map +7 -0
  8. package/dist/types/src/NavTreePlugin.d.ts +1 -0
  9. package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
  10. package/dist/types/src/NavTreePlugin.node.d.ts +4 -0
  11. package/dist/types/src/NavTreePlugin.node.d.ts.map +1 -0
  12. package/dist/types/src/NavTreePlugin.test.d.ts +2 -0
  13. package/dist/types/src/NavTreePlugin.test.d.ts.map +1 -0
  14. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  15. package/dist/types/src/capabilities/index.d.ts +1 -1
  16. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  17. package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
  18. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  19. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
  20. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  22. package/dist/types/src/components/NavTree/NavTree.stories.d.ts +8 -9
  23. package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +2 -2
  25. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
  26. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -1
  27. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
  29. package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
  30. package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
  31. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
  32. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
  33. package/dist/types/src/components/types.d.ts +0 -1
  34. package/dist/types/src/components/types.d.ts.map +1 -1
  35. package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -1
  36. package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts +8 -9
  37. package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts.map +1 -1
  38. package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -1
  39. package/dist/types/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.d.ts.map +1 -1
  40. package/dist/types/src/experimental/Tree.d.ts +2 -2
  41. package/dist/types/src/experimental/Tree.d.ts.map +1 -1
  42. package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
  43. package/dist/types/src/hooks/useActions.d.ts.map +1 -1
  44. package/dist/types/src/hooks/useLoadDescendents.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -1
  46. package/dist/types/src/hooks/useNavTreeState.d.ts +1 -5
  47. package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -1
  48. package/dist/types/src/index.d.ts +3 -2
  49. package/dist/types/src/index.d.ts.map +1 -1
  50. package/dist/types/src/operations/expose.d.ts +1 -1
  51. package/dist/types/src/operations/expose.d.ts.map +1 -1
  52. package/dist/types/src/operations/index.d.ts +1 -1
  53. package/dist/types/src/operations/index.d.ts.map +1 -1
  54. package/dist/types/src/testing/generator.d.ts.map +1 -1
  55. package/dist/types/src/testing/update-state.d.ts.map +1 -1
  56. package/dist/types/src/translations.d.ts +8 -10
  57. package/dist/types/src/translations.d.ts.map +1 -1
  58. package/dist/types/src/types/capabilities.d.ts +1 -2
  59. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  60. package/dist/types/src/types/events.d.ts.map +1 -1
  61. package/dist/types/src/util.d.ts +1 -1
  62. package/dist/types/src/util.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +49 -40
  65. package/src/NavTreePlugin.node.ts +37 -0
  66. package/src/NavTreePlugin.test.ts +29 -0
  67. package/src/NavTreePlugin.tsx +4 -3
  68. package/src/capabilities/app-graph-builder.ts +1 -1
  69. package/src/capabilities/index.ts +1 -1
  70. package/src/capabilities/operation-handler.ts +1 -1
  71. package/src/capabilities/react-surface.tsx +2 -3
  72. package/src/capabilities/state.ts +2 -2
  73. package/src/components/NavTree/NavTree.stories.tsx +2 -2
  74. package/src/components/NavTreeItem/NavTreeItemAction.tsx +3 -4
  75. package/src/components/Sidebar/L1Panel.tsx +82 -141
  76. package/src/components/types.ts +0 -1
  77. package/src/containers/CommandsDialogContent/CommandsDialogContent.stories.tsx +2 -1
  78. package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +42 -46
  79. package/src/containers/NavTreeContainer/NavTreeContainer.tsx +0 -9
  80. package/src/hooks/useNavTreeState.ts +1 -8
  81. package/src/index.ts +8 -2
  82. package/src/operations/expose.ts +1 -1
  83. package/src/operations/index.ts +1 -1
  84. package/src/translations.ts +0 -1
  85. package/src/types/capabilities.ts +2 -2
  86. 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
- <Dialog.Body>
75
- <SearchList.Root onSearch={handleSearch}>
76
- <SearchList.Content>
77
- <SearchList.Input placeholder={t('command-list-input.placeholder')} />
78
- <SearchList.Viewport>
79
- {results.map((action) => {
80
- const shortcut =
81
- typeof action.properties.keyBinding === 'string'
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
- return (
86
- <SearchList.Item
87
- value={action.id}
88
- key={action.id}
89
- label={toLocalizedString(action.properties.label, t)}
90
- icon={action.properties.icon}
91
- suffix={shortcut ? keySymbols(shortcut).join('') : undefined}
92
- onSelect={() => {
93
- if (action.properties.disabled) {
94
- return;
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
- if (Node.isActionGroup(action)) {
98
- setSelected(action.id);
99
- return;
100
- }
95
+ if (Node.isActionGroup(action)) {
96
+ setSelected(action.id);
97
+ return;
98
+ }
101
99
 
102
- void invokePromise(LayoutOperation.UpdateDialog, { state: false });
103
- setTimeout(() => {
104
- const lookupId = group?.id ?? action.id;
105
- const node = Graph.getConnections(graph, lookupId, Node.actionRelation('inbound'))[0];
106
- if (node && Node.isAction(action)) {
107
- void runAction(action, { parent: node, caller: KEY_BINDING });
108
- }
109
- });
110
- }}
111
- classNames='flex items-center gap-2'
112
- disabled={action.properties.disabled}
113
- {...(action.properties?.testId && {
114
- 'data-testid': action.properties.testId,
115
- })}
116
- />
117
- );
118
- })}
119
- </SearchList.Viewport>
120
- </SearchList.Content>
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' | 'alternateTree', next: boolean) => void;
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
- export { NavTreeCapabilities, NavTreeEvents } from './types';
6
- export * from './NavTreePlugin';
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';
@@ -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
 
@@ -2,6 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { OperationHandlerSet } from '@dxos/operation';
5
+ import { OperationHandlerSet } from '@dxos/compute';
6
6
 
7
7
  export const NavTreeOperationHandlerSet = OperationHandlerSet.lazy(() => import('./expose'));
@@ -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; alternateTree?: 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' | 'alternateTree', next: boolean) => void;
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 && (node.properties.disposition === 'hidden' || node.properties.disposition === 'alternate-tree')) {
96
+ if (!disposition && node.properties.disposition === 'hidden') {
97
97
  return false;
98
98
  } else if (!disposition) {
99
99
  const action = Node.isAction(node);