@dxos/plugin-navtree 0.7.4-staging.f7e8224 → 0.7.5-feature-compute.4d9d99a

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 (84) hide show
  1. package/dist/lib/browser/app-graph-builder-OF4MMBLH.mjs +42 -0
  2. package/dist/lib/browser/app-graph-builder-OF4MMBLH.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-IMGT2LAL.mjs +658 -0
  4. package/dist/lib/browser/chunk-IMGT2LAL.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-PSVCPL4T.mjs → chunk-KOXMEAOS.mjs} +5 -3
  6. package/dist/lib/browser/chunk-KOXMEAOS.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-OI7AAA6Q.mjs +15 -0
  8. package/dist/lib/browser/chunk-OI7AAA6Q.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +106 -1212
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/intent-resolver-74JPWYBP.mjs +42 -0
  12. package/dist/lib/browser/intent-resolver-74JPWYBP.mjs.map +7 -0
  13. package/dist/lib/browser/keyboard-MUBRTPI5.mjs +46 -0
  14. package/dist/lib/browser/keyboard-MUBRTPI5.mjs.map +7 -0
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/react-surface-6QWXI53A.mjs +189 -0
  17. package/dist/lib/browser/react-surface-6QWXI53A.mjs.map +7 -0
  18. package/dist/lib/browser/state-HT65TAYL.mjs +111 -0
  19. package/dist/lib/browser/state-HT65TAYL.mjs.map +7 -0
  20. package/dist/types/src/NavTreePlugin.d.ts +1 -3
  21. package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  23. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  24. package/dist/types/src/capabilities/capabilities.d.ts +17 -0
  25. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/index.d.ts +195 -0
  27. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  28. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  29. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  30. package/dist/types/src/capabilities/keyboard.d.ts +4 -0
  31. package/dist/types/src/capabilities/keyboard.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  33. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/state.d.ts +17 -0
  35. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  36. package/dist/types/src/components/CommandsTrigger.d.ts.map +1 -1
  37. package/dist/types/src/components/NavTree.d.ts +2 -2
  38. package/dist/types/src/components/NavTree.d.ts.map +1 -1
  39. package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
  40. package/dist/types/src/components/NavTreeFooter.d.ts.map +1 -1
  41. package/dist/types/src/components/NavTreeItemAction.d.ts +4 -8
  42. package/dist/types/src/components/NavTreeItemAction.d.ts.map +1 -1
  43. package/dist/types/src/components/NavTreeItemAction.stories.d.ts +0 -5
  44. package/dist/types/src/components/NavTreeItemAction.stories.d.ts.map +1 -1
  45. package/dist/types/src/components/NotchStart.d.ts.map +1 -1
  46. package/dist/types/src/components/index.d.ts +1 -0
  47. package/dist/types/src/components/index.d.ts.map +1 -1
  48. package/dist/types/src/events.d.ts +4 -0
  49. package/dist/types/src/events.d.ts.map +1 -0
  50. package/dist/types/src/index.d.ts +3 -2
  51. package/dist/types/src/index.d.ts.map +1 -1
  52. package/dist/types/src/meta.d.ts +2 -2
  53. package/dist/types/src/meta.d.ts.map +1 -1
  54. package/dist/types/src/translations.d.ts +0 -1
  55. package/dist/types/src/translations.d.ts.map +1 -1
  56. package/dist/types/src/types.d.ts +1 -1
  57. package/dist/types/src/types.d.ts.map +1 -1
  58. package/dist/types/tsconfig.tsbuildinfo +1 -0
  59. package/package.json +31 -38
  60. package/src/NavTreePlugin.tsx +70 -287
  61. package/src/capabilities/app-graph-builder.ts +40 -0
  62. package/src/capabilities/capabilities.ts +18 -0
  63. package/src/capabilities/index.ts +13 -0
  64. package/src/capabilities/intent-resolver.ts +30 -0
  65. package/src/capabilities/keyboard.ts +54 -0
  66. package/src/capabilities/react-surface.tsx +82 -0
  67. package/src/capabilities/state.ts +100 -0
  68. package/src/components/CommandsDialog.tsx +3 -3
  69. package/src/components/CommandsTrigger.tsx +11 -8
  70. package/src/components/NavTree.tsx +6 -11
  71. package/src/components/NavTreeContainer.tsx +22 -56
  72. package/src/components/NavTreeFooter.tsx +21 -18
  73. package/src/components/NavTreeItemAction.stories.tsx +0 -2
  74. package/src/components/NavTreeItemAction.tsx +51 -317
  75. package/src/components/NotchStart.tsx +8 -7
  76. package/src/components/index.ts +1 -0
  77. package/src/events.ts +11 -0
  78. package/src/index.ts +3 -4
  79. package/src/meta.ts +3 -1
  80. package/src/translations.ts +0 -1
  81. package/src/types.ts +1 -1
  82. package/dist/lib/browser/chunk-PSVCPL4T.mjs.map +0 -7
  83. package/dist/lib/browser/meta.mjs +0 -11
  84. package/dist/lib/browser/meta.mjs.map +0 -7
@@ -2,24 +2,12 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { useControllableState } from '@radix-ui/react-use-controllable-state';
6
- import React, { type MutableRefObject, type PropsWithChildren, useRef, useState } from 'react';
5
+ import React, { type MutableRefObject, useRef } from 'react';
7
6
 
8
- import { type Action, type ActionLike, type Node } from '@dxos/app-graph';
9
- import { keySymbols } from '@dxos/keyboard';
10
- import {
11
- Button,
12
- Dialog,
13
- DropdownMenu,
14
- ContextMenu,
15
- Tooltip,
16
- useTranslation,
17
- toLocalizedString,
18
- Icon,
19
- } from '@dxos/react-ui';
20
- import { SearchList } from '@dxos/react-ui-searchlist';
21
- import { descriptionText, hoverableControlItem, hoverableOpenControlItem, mx } from '@dxos/react-ui-theme';
22
- import { getHostPlatform } from '@dxos/util';
7
+ import { type Action, type Node } from '@dxos/app-graph';
8
+ import { useTranslation, toLocalizedString, IconButton } from '@dxos/react-ui';
9
+ import { DropdownMenu, MenuProvider, type MenuItem } from '@dxos/react-ui-menu';
10
+ import { hoverableControlItem, hoverableOpenControlItem, mx } from '@dxos/react-ui-theme';
23
11
 
24
12
  import { NAVTREE_PLUGIN } from '../meta';
25
13
  import { type ActionProperties } from '../types';
@@ -30,338 +18,84 @@ export type NavTreeItemActionMenuProps = ActionProperties & {
30
18
  monolithic?: boolean;
31
19
  menuActions?: Action[];
32
20
  suppressNextTooltip?: MutableRefObject<boolean>;
33
- menuOpen?: boolean;
34
- defaultMenuOpen?: boolean;
35
- onChangeMenuOpen?: (nextOpen: boolean) => void;
36
21
  onAction?: (action: Action) => void;
37
22
  };
38
23
 
39
- const getShortcut = (action: ActionLike) => {
40
- return typeof action.properties?.keyBinding === 'string'
41
- ? action.properties.keyBinding
42
- : action.properties?.keyBinding?.[getHostPlatform()];
43
- };
44
-
45
24
  const fallbackIcon = 'ph--placeholder--regular';
46
25
 
26
+ const actionButtonProps = {
27
+ iconOnly: true,
28
+ size: 4 as const,
29
+ variant: 'ghost' as const,
30
+ density: 'fine' as const,
31
+ classNames: mx('shrink-0 !pli-2 pointer-fine:!pli-1', hoverableControlItem, hoverableOpenControlItem),
32
+ };
33
+
47
34
  export const NavTreeItemActionDropdownMenu = ({
48
35
  label,
49
36
  icon,
50
37
  testId,
51
- defaultMenuOpen,
52
38
  menuActions,
53
- menuOpen,
54
- suppressNextTooltip,
55
- onChangeMenuOpen,
56
39
  onAction,
57
40
  }: NavTreeItemActionMenuProps) => {
58
41
  const { t } = useTranslation(NAVTREE_PLUGIN);
59
-
60
- const [optionsMenuOpen, setOptionsMenuOpen] = useControllableState({
61
- prop: menuOpen,
62
- defaultProp: defaultMenuOpen,
63
- onChange: onChangeMenuOpen,
64
- });
65
-
42
+ const suppressNextTooltip = useRef<boolean>(false);
66
43
  return (
67
- <DropdownMenu.Root
68
- {...{
69
- open: optionsMenuOpen,
70
- onOpenChange: (nextOpen: boolean) => {
71
- if (!nextOpen && suppressNextTooltip) {
72
- suppressNextTooltip.current = true;
73
- }
74
- return setOptionsMenuOpen(nextOpen);
75
- },
76
- }}
77
- >
78
- <Tooltip.Trigger asChild>
44
+ <MenuProvider onAction={onAction}>
45
+ <DropdownMenu.Root items={menuActions as MenuItem[]} suppressNextTooltip={suppressNextTooltip}>
79
46
  <DropdownMenu.Trigger asChild>
80
- <Button
81
- variant='ghost'
82
- density='fine'
83
- classNames={mx('shrink-0 !pli-2 pointer-fine:!pli-1', hoverableControlItem, hoverableOpenControlItem)}
47
+ <IconButton
48
+ {...actionButtonProps}
49
+ icon={icon ?? fallbackIcon}
50
+ label={toLocalizedString(label, t)}
84
51
  data-testid={testId}
85
- aria-label={t('tree item actions label')}
86
- >
87
- <span className='sr-only'>{toLocalizedString(label, t)}</span>
88
- <Icon icon={icon ?? fallbackIcon} size={4} />
89
- </Button>
52
+ suppressNextTooltip={suppressNextTooltip}
53
+ />
90
54
  </DropdownMenu.Trigger>
91
- </Tooltip.Trigger>
92
- <DropdownMenu.Portal>
93
- <DropdownMenu.Content classNames='z-[31]'>
94
- <DropdownMenu.Viewport>
95
- {menuActions?.map((action) => {
96
- const shortcut = getShortcut(action);
97
- return (
98
- <DropdownMenu.Item
99
- key={action.id}
100
- onClick={(event) => {
101
- if (action.properties?.disabled) {
102
- return;
103
- }
104
- event.stopPropagation();
105
- // TODO(thure): Why does Dialog’s modal-ness cause issues if we don’t explicitly close the menu here?
106
- if (suppressNextTooltip) {
107
- suppressNextTooltip.current = true;
108
- }
109
- setOptionsMenuOpen(false);
110
- onAction?.(action);
111
- }}
112
- classNames='gap-2'
113
- disabled={action.properties?.disabled}
114
- {...(action.properties?.testId && { 'data-testid': action.properties.testId })}
115
- >
116
- {action.properties?.icon && <Icon icon={action.properties!.icon} size={4} />}
117
- <span className='grow truncate'>{toLocalizedString(action.properties!.label, t)}</span>
118
- {shortcut && <span className={mx('shrink-0', descriptionText)}>{keySymbols(shortcut).join('')}</span>}
119
- </DropdownMenu.Item>
120
- );
121
- })}
122
- </DropdownMenu.Viewport>
123
- <DropdownMenu.Arrow />
124
- </DropdownMenu.Content>
125
- </DropdownMenu.Portal>
126
- </DropdownMenu.Root>
127
- );
128
- };
129
-
130
- export const NavTreeItemActionContextMenu = (
131
- props: PropsWithChildren<Pick<NavTreeItemActionMenuProps, 'menuActions' | 'onAction'>>,
132
- ) => {
133
- return (props.menuActions?.length ?? 0) > 0 ? <NavTreeItemActionContextMenuImpl {...props} /> : <>{props.children}</>;
134
- };
135
-
136
- const NavTreeItemActionContextMenuImpl = ({
137
- menuActions,
138
- onAction,
139
- children,
140
- }: PropsWithChildren<Pick<NavTreeItemActionMenuProps, 'menuActions' | 'onAction'>>) => {
141
- const { t } = useTranslation(NAVTREE_PLUGIN);
142
-
143
- return (
144
- <ContextMenu.Root>
145
- <ContextMenu.Trigger asChild>{children}</ContextMenu.Trigger>
146
- <ContextMenu.Portal>
147
- <ContextMenu.Content classNames='z-[31]'>
148
- <ContextMenu.Viewport>
149
- {menuActions?.map((action) => {
150
- const shortcut = getShortcut(action);
151
- return (
152
- <ContextMenu.Item
153
- key={action.id}
154
- onClick={(event) => {
155
- if (action.properties?.disabled) {
156
- return;
157
- }
158
- event.stopPropagation();
159
- onAction?.(action);
160
- }}
161
- classNames='gap-2'
162
- disabled={action.properties?.disabled}
163
- {...(action.properties?.testId && { 'data-testid': action.properties.testId })}
164
- >
165
- {action.properties?.icon && <Icon icon={action.properties?.icon} size={4} />}
166
- <span className='grow truncate'>{toLocalizedString(action.properties!.label, t)}</span>
167
- {shortcut && <span className={mx('shrink-0', descriptionText)}>{keySymbols(shortcut).join('')}</span>}
168
- </ContextMenu.Item>
169
- );
170
- })}
171
- </ContextMenu.Viewport>
172
- <ContextMenu.Arrow />
173
- </ContextMenu.Content>
174
- </ContextMenu.Portal>
175
- </ContextMenu.Root>
176
- );
177
- };
178
-
179
- export const NavTreeItemActionSearchList = ({
180
- menuActions,
181
- icon,
182
- label,
183
- testId,
184
- suppressNextTooltip,
185
- onAction,
186
- }: Pick<
187
- NavTreeItemActionMenuProps,
188
- 'icon' | 'menuActions' | 'testId' | 'label' | 'onAction' | 'suppressNextTooltip'
189
- >) => {
190
- const { t } = useTranslation(NAVTREE_PLUGIN);
191
-
192
- const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
193
- const button = useRef<HTMLButtonElement | null>(null);
194
-
195
- // TODO(burdon): Optionally sort.
196
- const sortedActions = menuActions?.sort(({ properties: p1 }, { properties: p2 }) => {
197
- const t1 = toLocalizedString(p1!.label, t).toLowerCase();
198
- const t2 = toLocalizedString(p2!.label, t).toLowerCase();
199
- return t1.localeCompare(t2);
200
- });
201
-
202
- // TODO(thure): Use LayoutPlugin’s global Dialog.
203
- return (
204
- <Dialog.Root
205
- {...{
206
- open: optionsMenuOpen,
207
- onOpenChange: (nextOpen: boolean) => {
208
- if (!nextOpen && suppressNextTooltip) {
209
- suppressNextTooltip.current = true;
210
- }
211
- return setOptionsMenuOpen(nextOpen);
212
- },
213
- }}
214
- >
215
- <Tooltip.Trigger asChild>
216
- <Dialog.Trigger asChild>
217
- <Button
218
- variant='ghost'
219
- density='fine'
220
- classNames={mx('shrink-0 !pli-2 pointer-fine:!pli-1', hoverableControlItem, hoverableOpenControlItem)}
221
- data-testid={testId}
222
- onKeyDownCapture={(event) => {
223
- // TODO(thure): Why is only this `Button` affected and not `DropdownMenu.Trigger`’s?
224
- if (button.current && button.current === event.target) {
225
- switch (event.key) {
226
- case 'Enter':
227
- case ' ':
228
- // Capture this event and stop propagation to the drag start handler.
229
- event.stopPropagation();
230
- setOptionsMenuOpen(true);
231
- break;
232
- default:
233
- }
234
- }
235
- }}
236
- ref={button}
237
- >
238
- <Icon icon={icon ?? fallbackIcon} size={4} />
239
- </Button>
240
- </Dialog.Trigger>
241
- </Tooltip.Trigger>
242
- <Dialog.Portal>
243
- <Dialog.Overlay>
244
- <Dialog.Content classNames='z-[31] is-full max-is-[24rem] pli-2 plb-1'>
245
- <SearchList.Root label={t('tree item searchlist input placeholder')}>
246
- <SearchList.Input placeholder={t('tree item searchlist input placeholder')} classNames='pli-3' />
247
- <SearchList.Content classNames='min-bs-[12rem] bs-[50dvh] max-bs-[30rem] overflow-auto'>
248
- {sortedActions?.map((action) => {
249
- const label = toLocalizedString(action.properties!.label, t);
250
- const shortcut = getShortcut(action);
251
- return (
252
- <SearchList.Item
253
- // TODO(burdon): Value should be id since label is not unique.
254
- value={label}
255
- key={action.id}
256
- onSelect={() => {
257
- if (action.properties?.disabled) {
258
- return;
259
- }
260
- if (suppressNextTooltip) {
261
- suppressNextTooltip.current = true;
262
- }
263
- setOptionsMenuOpen(false);
264
- onAction?.(action);
265
- }}
266
- classNames='flex items-center gap-2 pli-2'
267
- disabled={action.properties?.disabled}
268
- {...(action.properties?.testId && { 'data-testid': action.properties.testId })}
269
- >
270
- {action.properties?.icon && <Icon icon={action.properties?.icon} size={4} />}
271
- <span className='grow truncate'>{label}</span>
272
- {shortcut && (
273
- <span className={mx('shrink-0', descriptionText)}>{keySymbols(shortcut).join('')}</span>
274
- )}
275
- </SearchList.Item>
276
- );
277
- })}
278
- </SearchList.Content>
279
- <div role='none' className='flex items-center plb-2 pli-3'>
280
- <span className={descriptionText}>{toLocalizedString(label, t)}</span>
281
- </div>
282
- </SearchList.Root>
283
- </Dialog.Content>
284
- </Dialog.Overlay>
285
- </Dialog.Portal>
286
- </Dialog.Root>
55
+ </DropdownMenu.Root>
56
+ </MenuProvider>
287
57
  );
288
58
  };
289
59
 
290
60
  export const NavTreeItemMonolithicAction = ({
291
61
  parent,
292
- properties: { disabled, caller, testId, label, icon } = { label: 'never' },
62
+ properties: { disabled, caller, testId, icon } = { label: 'never' },
293
63
  data: invoke,
294
- }: Action & { parent: Node; onAction?: (action: Action) => void }) => {
295
- const { t } = useTranslation(NAVTREE_PLUGIN);
64
+ baseLabel,
65
+ }: Action & { parent: Node; onAction?: (action: Action) => void; baseLabel: string }) => {
296
66
  return (
297
- <Tooltip.Trigger asChild>
298
- <Button
299
- variant='ghost'
300
- density='fine'
301
- classNames={mx('shrink-0 !pli-2 pointer-fine:!pli-1', hoverableControlItem, hoverableOpenControlItem)}
302
- disabled={disabled}
303
- onClick={(event) => {
304
- if (disabled) {
305
- return;
306
- }
307
- event.stopPropagation();
308
- void invoke?.(caller ? { node: parent, caller } : { node: parent });
309
- }}
310
- data-testid={testId}
311
- >
312
- <span className='sr-only'>{toLocalizedString(label, t)}</span>
313
- <Icon icon={icon ?? fallbackIcon} size={4} />
314
- </Button>
315
- </Tooltip.Trigger>
67
+ <IconButton
68
+ {...actionButtonProps}
69
+ icon={icon ?? fallbackIcon}
70
+ label={baseLabel}
71
+ disabled={disabled}
72
+ onClick={(event) => {
73
+ if (disabled) {
74
+ return;
75
+ }
76
+ event.stopPropagation();
77
+ void invoke?.(caller ? { node: parent, caller } : { node: parent });
78
+ }}
79
+ data-testid={testId}
80
+ />
316
81
  );
317
82
  };
318
83
 
319
84
  export const NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }: NavTreeItemActionMenuProps) => {
320
85
  const { t } = useTranslation(NAVTREE_PLUGIN);
321
- const suppressNextTooltip = useRef<boolean>(false);
322
- const [triggerTooltipOpen, setTriggerTooltipOpen] = useState(false);
323
86
 
324
87
  const monolithicAction = menuActions?.length === 1 && menuActions[0];
325
88
  const baseLabel = toLocalizedString(monolithicAction ? monolithicAction.properties!.label : props.label, t);
326
89
 
327
- return (
328
- <Tooltip.Root
329
- open={triggerTooltipOpen}
330
- onOpenChange={(nextOpen) => {
331
- if (suppressNextTooltip.current) {
332
- setTriggerTooltipOpen(false);
333
- suppressNextTooltip.current = false;
334
- } else {
335
- setTriggerTooltipOpen(nextOpen);
336
- }
337
- }}
338
- >
339
- {baseLabel && (
340
- <Tooltip.Portal>
341
- <Tooltip.Content classNames='z-[31]' side='bottom'>
342
- {baseLabel}
343
- <Tooltip.Arrow />
344
- </Tooltip.Content>
345
- </Tooltip.Portal>
346
- )}
347
- {monolithic && menuActions?.length === 1 ? (
348
- <NavTreeItemMonolithicAction parent={node} {...menuActions[0]} />
349
- ) : props.menuType === 'searchList' ? (
350
- <NavTreeItemActionSearchList
351
- {...props}
352
- menuActions={menuActions}
353
- suppressNextTooltip={suppressNextTooltip}
354
- onAction={(action) => action.data?.(props.caller ? { node, caller: props.caller } : { node })}
355
- />
356
- ) : (
357
- <NavTreeItemActionDropdownMenu
358
- {...props}
359
- parent={node}
360
- menuActions={menuActions}
361
- suppressNextTooltip={suppressNextTooltip}
362
- onAction={(action) => action.data?.(props.caller ? { node, caller: props.caller } : { node })}
363
- />
364
- )}
365
- </Tooltip.Root>
90
+ return monolithic && menuActions?.length === 1 ? (
91
+ <NavTreeItemMonolithicAction baseLabel={baseLabel} parent={node} {...menuActions[0]} />
92
+ ) : (
93
+ <NavTreeItemActionDropdownMenu
94
+ {...props}
95
+ label={baseLabel}
96
+ parent={node}
97
+ menuActions={menuActions}
98
+ onAction={(action) => action.data?.(props.caller ? { node, caller: props.caller } : { node })}
99
+ />
366
100
  );
367
101
  };
@@ -4,9 +4,9 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { useIntentDispatcher, useResolvePlugin } from '@dxos/app-framework';
8
- import { ClientAction } from '@dxos/plugin-client/meta';
9
- import { parseObservabilityPlugin } from '@dxos/plugin-observability';
7
+ import { createIntent, useIntentDispatcher, useCapabilities } from '@dxos/app-framework';
8
+ import { ClientAction } from '@dxos/plugin-client/types';
9
+ import { ObservabilityCapabilities } from '@dxos/plugin-observability';
10
10
  import { useIdentity } from '@dxos/react-client/halo';
11
11
 
12
12
  import { HaloButton } from './HaloButton';
@@ -14,16 +14,17 @@ import { HaloButton } from './HaloButton';
14
14
  // TODO(thure): Refactor to be handled by a more appropriate plugin (ClientPlugin?).
15
15
  export const NotchStart = () => {
16
16
  const identity = useIdentity();
17
- const observabilityPlugin = useResolvePlugin(parseObservabilityPlugin);
18
- const dispatch = useIntentDispatcher();
17
+ // TODO(wittjosiah): Can this be removed now?
18
+ const [observability] = useCapabilities(ObservabilityCapabilities.Observability);
19
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
19
20
  return (
20
21
  <HaloButton
21
22
  size={8}
22
23
  identityKey={identity?.identityKey.toHex()}
23
24
  hue={identity?.profile?.data?.hue}
24
25
  emoji={identity?.profile?.data?.emoji}
25
- internal={observabilityPlugin?.provides?.observability?.group === 'dxos'}
26
- onClick={() => dispatch({ action: ClientAction.SHARE_IDENTITY })}
26
+ internal={observability?.group === 'dxos'}
27
+ onClick={() => dispatch(createIntent(ClientAction.ShareIdentity))}
27
28
  />
28
29
  );
29
30
  };
@@ -3,6 +3,7 @@
3
3
  //
4
4
 
5
5
  export * from './CommandsDialog';
6
+ export * from './CommandsTrigger';
6
7
  export * from './NavTree';
7
8
  export * from './NavTreeContainer';
8
9
  export * from './NavTreeDocumentTitle';
package/src/events.ts ADDED
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Events } from '@dxos/app-framework';
6
+
7
+ import { NAVTREE_PLUGIN } from './meta';
8
+
9
+ export namespace NavTreeEvents {
10
+ export const StateReady = Events.createStateEvent(NAVTREE_PLUGIN);
11
+ }
package/src/index.ts CHANGED
@@ -2,9 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { NavTreePlugin } from './NavTreePlugin';
6
-
7
- export default NavTreePlugin;
8
-
5
+ export { NavTreeCapabilities } from './capabilities';
6
+ export { NavTreeEvents } from './events';
9
7
  export * from './NavTreePlugin';
8
+ export * from './meta';
10
9
  export * from './util';
package/src/meta.ts CHANGED
@@ -8,7 +8,9 @@ export const NAVTREE_PLUGIN = 'dxos.org/plugin/navtree';
8
8
 
9
9
  // TODO(wittjosiah): Factor out.
10
10
  export const KEY_BINDING = 'KeyBinding';
11
+ // TODO(wittjosiah): Factor out.
12
+ export const COMMANDS_DIALOG = `${NAVTREE_PLUGIN}/CommandsDialog`;
11
13
 
12
- export default {
14
+ export const meta = {
13
15
  id: NAVTREE_PLUGIN,
14
16
  } satisfies PluginMeta;
@@ -20,7 +20,6 @@ export default [
20
20
  'see release label': 'See release on GitHub',
21
21
  'powered by dxos message': 'Powered by <dxos>DXOS</dxos>',
22
22
  'tree item actions label': 'More actions',
23
- 'tree item searchlist input placeholder': 'Search for actions…',
24
23
  'empty branch message': ' ',
25
24
  },
26
25
  },
package/src/types.ts CHANGED
@@ -47,7 +47,7 @@ export type ActionProperties = SharedProperties & {
47
47
  disposition?: string;
48
48
  hidden?: boolean;
49
49
  caller?: string;
50
- menuType?: 'searchList' | 'dropdown';
50
+ menuType?: 'dropdown';
51
51
  keyBinding?: string | KeyBinding;
52
52
  };
53
53
 
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const NAVTREE_PLUGIN = 'dxos.org/plugin/navtree';\n\n// TODO(wittjosiah): Factor out.\nexport const KEY_BINDING = 'KeyBinding';\n\nexport default {\n id: NAVTREE_PLUGIN,\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,iBAAiB;AAGvB,IAAMC,cAAc;AAE3B,IAAA,eAAe;EACbC,IAAIF;AACN;",
6
- "names": ["NAVTREE_PLUGIN", "KEY_BINDING", "id"]
7
- }
@@ -1,11 +0,0 @@
1
- import {
2
- KEY_BINDING,
3
- NAVTREE_PLUGIN,
4
- meta_default
5
- } from "./chunk-PSVCPL4T.mjs";
6
- export {
7
- KEY_BINDING,
8
- NAVTREE_PLUGIN,
9
- meta_default as default
10
- };
11
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }