@dxos/plugin-navtree 0.7.4 → 0.7.5-main.9cb18ac
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/{chunk-PSVCPL4T.mjs → chunk-VAXG4OAG.mjs} +3 -1
- package/dist/lib/browser/chunk-VAXG4OAG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +124 -144
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +3 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/components/CommandsTrigger.d.ts.map +1 -1
- package/dist/types/src/components/NavTree.d.ts +2 -0
- package/dist/types/src/components/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeFooter.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +29 -29
- package/src/NavTreePlugin.tsx +67 -62
- package/src/components/CommandsDialog.tsx +3 -3
- package/src/components/CommandsTrigger.tsx +10 -7
- package/src/components/NavTree.tsx +6 -3
- package/src/components/NavTreeContainer.tsx +32 -54
- package/src/components/NavTreeFooter.tsx +3 -2
- package/src/components/NavTreeItemAction.tsx +3 -3
- package/src/components/NotchStart.tsx +4 -4
- package/src/meta.ts +2 -0
- package/dist/lib/browser/chunk-PSVCPL4T.mjs.map +0 -7
|
@@ -7,11 +7,11 @@ import { extractInstruction, type Instruction } from '@atlaskit/pragmatic-drag-a
|
|
|
7
7
|
import { untracked } from '@preact/signals-core';
|
|
8
8
|
import React, { memo, useCallback, useEffect } from 'react';
|
|
9
9
|
|
|
10
|
-
import { LayoutAction, NavigationAction, Surface, useIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
+
import { createIntent, LayoutAction, NavigationAction, Surface, useIntentDispatcher } from '@dxos/app-framework';
|
|
11
11
|
import { isAction, isActionLike, type Node } from '@dxos/app-graph';
|
|
12
12
|
import { useGraph } from '@dxos/plugin-graph';
|
|
13
13
|
import { isEchoObject, isSpace } from '@dxos/react-client/echo';
|
|
14
|
-
import {
|
|
14
|
+
import { useMediaQuery, useSidebars } from '@dxos/react-ui';
|
|
15
15
|
import { isTreeData, type TreeData, type PropsFromTreeItem } from '@dxos/react-ui-list';
|
|
16
16
|
import { mx } from '@dxos/react-ui-theme';
|
|
17
17
|
import { arrayMove } from '@dxos/util';
|
|
@@ -32,8 +32,8 @@ import {
|
|
|
32
32
|
// TODO(thure): Is NavTree truly authoritative in this regard?
|
|
33
33
|
export const NODE_TYPE = 'dxos/app-graph/node';
|
|
34
34
|
|
|
35
|
-
const renderItemEnd = ({ node }: { node: Node }) => (
|
|
36
|
-
<Surface role='navtree-item-end' data={{
|
|
35
|
+
const renderItemEnd = ({ node, open }: { node: Node; open: boolean }) => (
|
|
36
|
+
<Surface role='navtree-item-end' data={{ id: node.id, subject: node.data, open }} limit={1} />
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
export type NavTreeContainerProps = {
|
|
@@ -43,7 +43,7 @@ export type NavTreeContainerProps = {
|
|
|
43
43
|
export const NavTreeContainer = memo(({ isCurrent, popoverAnchorId, ...props }: NavTreeContainerProps) => {
|
|
44
44
|
const { closeNavigationSidebar } = useSidebars(NAVTREE_PLUGIN);
|
|
45
45
|
const [isLg] = useMediaQuery('lg', { ssr: false });
|
|
46
|
-
const dispatch = useIntentDispatcher();
|
|
46
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
47
47
|
const { graph } = useGraph();
|
|
48
48
|
|
|
49
49
|
const getActions = useCallback((node: Node) => naturalGetActions(graph, node), [graph]);
|
|
@@ -124,28 +124,11 @@ export const NavTreeContainer = memo(({ isCurrent, popoverAnchorId, ...props }:
|
|
|
124
124
|
|
|
125
125
|
const current = isCurrent(path, node);
|
|
126
126
|
if (!current) {
|
|
127
|
-
void dispatch({
|
|
128
|
-
action: NavigationAction.OPEN,
|
|
129
|
-
data: {
|
|
130
|
-
activeParts: {
|
|
131
|
-
main: [node.id],
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
});
|
|
127
|
+
void dispatch(createIntent(NavigationAction.Open, { activeParts: { main: [node.id] } }));
|
|
135
128
|
} else if (option) {
|
|
136
|
-
void dispatch({
|
|
137
|
-
action: NavigationAction.CLOSE,
|
|
138
|
-
data: {
|
|
139
|
-
activeParts: {
|
|
140
|
-
main: [node.id],
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
});
|
|
129
|
+
void dispatch(createIntent(NavigationAction.Close, { activeParts: { main: [node.id] } }));
|
|
144
130
|
} else {
|
|
145
|
-
void dispatch({
|
|
146
|
-
action: LayoutAction.SCROLL_INTO_VIEW,
|
|
147
|
-
data: { id: node.id },
|
|
148
|
-
});
|
|
131
|
+
void dispatch(createIntent(LayoutAction.ScrollIntoView, { id: node.id }));
|
|
149
132
|
}
|
|
150
133
|
|
|
151
134
|
const defaultAction = graph.actions(node).find((action) => action.properties?.disposition === 'default');
|
|
@@ -220,35 +203,30 @@ export const NavTreeContainer = memo(({ isCurrent, popoverAnchorId, ...props }:
|
|
|
220
203
|
}, [graph]);
|
|
221
204
|
|
|
222
205
|
return (
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
>
|
|
228
|
-
{/* TODO(wittjosiah): Factor out surfaces to layout? */}
|
|
229
|
-
<div role='none' className='border-be border-separator'>
|
|
230
|
-
<Surface role='search-input' limit={1} />
|
|
231
|
-
</div>
|
|
232
|
-
|
|
233
|
-
{/* TODO(thure): What gives this an inline `overflow: initial`? */}
|
|
234
|
-
<div role='none' className='border-be border-separator !overflow-y-auto'>
|
|
235
|
-
<NavTree
|
|
236
|
-
id={graph.root.id}
|
|
237
|
-
getActions={getActions}
|
|
238
|
-
getItems={getItems}
|
|
239
|
-
getProps={getProps}
|
|
240
|
-
isCurrent={isCurrent}
|
|
241
|
-
loadDescendents={loadDescendents}
|
|
242
|
-
renderItemEnd={renderItemEnd}
|
|
243
|
-
popoverAnchorId={popoverAnchorId}
|
|
244
|
-
canDrop={canDrop}
|
|
245
|
-
onSelect={handleSelect}
|
|
246
|
-
{...props}
|
|
247
|
-
/>
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<NavTreeFooter />
|
|
206
|
+
<div role='none' className='grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] bs-full overflow-hidden'>
|
|
207
|
+
{/* TODO(wittjosiah): Factor out surfaces to layout? */}
|
|
208
|
+
<div role='none' className='border-be border-separator'>
|
|
209
|
+
<Surface role='search-input' limit={1} />
|
|
251
210
|
</div>
|
|
252
|
-
|
|
211
|
+
|
|
212
|
+
{/* TODO(thure): What gives this an inline `overflow: initial`? */}
|
|
213
|
+
<div role='none' className='border-be border-separator !overflow-y-auto'>
|
|
214
|
+
<NavTree
|
|
215
|
+
id={graph.root.id}
|
|
216
|
+
getActions={getActions}
|
|
217
|
+
getItems={getItems}
|
|
218
|
+
getProps={getProps}
|
|
219
|
+
isCurrent={isCurrent}
|
|
220
|
+
loadDescendents={loadDescendents}
|
|
221
|
+
renderItemEnd={renderItemEnd}
|
|
222
|
+
popoverAnchorId={popoverAnchorId}
|
|
223
|
+
canDrop={canDrop}
|
|
224
|
+
onSelect={handleSelect}
|
|
225
|
+
{...props}
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
<NavTreeFooter />
|
|
230
|
+
</div>
|
|
253
231
|
);
|
|
254
232
|
});
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
parseNavigationPlugin,
|
|
13
13
|
useResolvePlugin,
|
|
14
14
|
useIntentDispatcher,
|
|
15
|
+
createIntent,
|
|
15
16
|
} from '@dxos/app-framework';
|
|
16
17
|
import { useConfig } from '@dxos/react-client';
|
|
17
18
|
import {
|
|
@@ -41,7 +42,7 @@ export const NavTreeFooter = (props: { layoutPart?: LayoutPart }) => {
|
|
|
41
42
|
const config = useConfig();
|
|
42
43
|
const { t } = useTranslation(NAVTREE_PLUGIN);
|
|
43
44
|
const { navigationSidebarOpen } = useSidebars(NAVTREE_PLUGIN);
|
|
44
|
-
const dispatch = useIntentDispatcher();
|
|
45
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
45
46
|
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
46
47
|
const navigationPlugin = useResolvePlugin(parseNavigationPlugin);
|
|
47
48
|
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
@@ -126,7 +127,7 @@ export const NavTreeFooter = (props: { layoutPart?: LayoutPart }) => {
|
|
|
126
127
|
data-testid='treeView.openSettings'
|
|
127
128
|
data-joyride='welcome/settings'
|
|
128
129
|
{...(!navigationSidebarOpen && { tabIndex: -1 })}
|
|
129
|
-
onClick={() => dispatch(
|
|
130
|
+
onClick={() => dispatch(createIntent(SettingsAction.Open))}
|
|
130
131
|
>
|
|
131
132
|
<span className='sr-only'>{t('open settings label')}</span>
|
|
132
133
|
<GearSix className={mx(getSize(5), 'rotate-90')} />
|
|
@@ -90,7 +90,7 @@ export const NavTreeItemActionDropdownMenu = ({
|
|
|
90
90
|
</DropdownMenu.Trigger>
|
|
91
91
|
</Tooltip.Trigger>
|
|
92
92
|
<DropdownMenu.Portal>
|
|
93
|
-
<DropdownMenu.Content
|
|
93
|
+
<DropdownMenu.Content>
|
|
94
94
|
<DropdownMenu.Viewport>
|
|
95
95
|
{menuActions?.map((action) => {
|
|
96
96
|
const shortcut = getShortcut(action);
|
|
@@ -144,7 +144,7 @@ const NavTreeItemActionContextMenuImpl = ({
|
|
|
144
144
|
<ContextMenu.Root>
|
|
145
145
|
<ContextMenu.Trigger asChild>{children}</ContextMenu.Trigger>
|
|
146
146
|
<ContextMenu.Portal>
|
|
147
|
-
<ContextMenu.Content
|
|
147
|
+
<ContextMenu.Content>
|
|
148
148
|
<ContextMenu.Viewport>
|
|
149
149
|
{menuActions?.map((action) => {
|
|
150
150
|
const shortcut = getShortcut(action);
|
|
@@ -241,7 +241,7 @@ export const NavTreeItemActionSearchList = ({
|
|
|
241
241
|
</Tooltip.Trigger>
|
|
242
242
|
<Dialog.Portal>
|
|
243
243
|
<Dialog.Overlay>
|
|
244
|
-
<Dialog.Content classNames='
|
|
244
|
+
<Dialog.Content classNames='is-full max-is-[24rem] pli-2 plb-1'>
|
|
245
245
|
<SearchList.Root label={t('tree item searchlist input placeholder')}>
|
|
246
246
|
<SearchList.Input placeholder={t('tree item searchlist input placeholder')} classNames='pli-3' />
|
|
247
247
|
<SearchList.Content classNames='min-bs-[12rem] bs-[50dvh] max-bs-[30rem] overflow-auto'>
|
|
@@ -4,8 +4,8 @@
|
|
|
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/
|
|
7
|
+
import { createIntent, useIntentDispatcher, useResolvePlugin } from '@dxos/app-framework';
|
|
8
|
+
import { ClientAction } from '@dxos/plugin-client/types';
|
|
9
9
|
import { parseObservabilityPlugin } from '@dxos/plugin-observability';
|
|
10
10
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
11
11
|
|
|
@@ -15,7 +15,7 @@ import { HaloButton } from './HaloButton';
|
|
|
15
15
|
export const NotchStart = () => {
|
|
16
16
|
const identity = useIdentity();
|
|
17
17
|
const observabilityPlugin = useResolvePlugin(parseObservabilityPlugin);
|
|
18
|
-
const dispatch = useIntentDispatcher();
|
|
18
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
19
19
|
return (
|
|
20
20
|
<HaloButton
|
|
21
21
|
size={8}
|
|
@@ -23,7 +23,7 @@ export const NotchStart = () => {
|
|
|
23
23
|
hue={identity?.profile?.data?.hue}
|
|
24
24
|
emoji={identity?.profile?.data?.emoji}
|
|
25
25
|
internal={observabilityPlugin?.provides?.observability?.group === 'dxos'}
|
|
26
|
-
onClick={() => dispatch(
|
|
26
|
+
onClick={() => dispatch(createIntent(ClientAction.ShareIdentity))}
|
|
27
27
|
/>
|
|
28
28
|
);
|
|
29
29
|
};
|
package/src/meta.ts
CHANGED
|
@@ -8,6 +8,8 @@ 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
14
|
export default {
|
|
13
15
|
id: NAVTREE_PLUGIN,
|
|
@@ -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
|
-
}
|