@dxos/plugin-navtree 0.6.13 → 0.6.14-main.2b6a0f3
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-U7MTKDFQ.mjs → chunk-PSVCPL4T.mjs} +1 -1
- package/dist/lib/browser/chunk-PSVCPL4T.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +57 -44
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog.d.ts.map +1 -1
- package/dist/types/src/components/HaloButton.stories.d.ts +5 -9
- package/dist/types/src/components/HaloButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavBarStart.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +3 -7
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/stories/Graph.stories.d.ts +3 -6
- package/dist/types/src/stories/Graph.stories.d.ts.map +1 -1
- package/package.json +32 -30
- package/src/NavTreePlugin.tsx +2 -4
- package/src/components/CommandsDialog.tsx +2 -4
- package/src/components/HaloButton.stories.tsx +8 -6
- package/src/components/NavBarStart.tsx +2 -4
- package/src/components/NavTreeContainer.tsx +78 -64
- package/src/components/NavTreeFooter.tsx +1 -1
- package/src/experimental/Tree.stories.tsx +11 -8
- package/src/experimental/Tree.tsx +2 -2
- package/src/meta.ts +3 -1
- package/src/stories/Graph.stories.tsx +11 -8
- package/dist/lib/browser/chunk-U7MTKDFQ.mjs.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandsDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/CommandsDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommandsDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/CommandsDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAcjD,eAAO,MAAM,qBAAqB,0BAA2B;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,sBA6FjF,CAAC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
argTypesRegex: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
11
|
-
export declare const Normal: (props: any) => React.JSX.Element;
|
|
4
|
+
import { HaloButton } from './HaloButton';
|
|
5
|
+
export declare const Default: (props: any) => React.JSX.Element;
|
|
6
|
+
declare const meta: Meta<typeof HaloButton>;
|
|
7
|
+
export default meta;
|
|
12
8
|
//# sourceMappingURL=HaloButton.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HaloButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/HaloButton.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"HaloButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/HaloButton.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,eAAO,MAAM,OAAO,UAAW,GAAG,sBAEjC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAGjC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavBarStart.d.ts","sourceRoot":"","sources":["../../../../src/components/NavBarStart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NavBarStart.d.ts","sourceRoot":"","sources":["../../../../src/components/NavBarStart.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAY,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAQtD,eAAO,MAAM,WAAW,oCAAqC;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,sBA+B1G,CAAC"}
|
|
@@ -6,7 +6,7 @@ export declare const NavTreeContainer: ({ root, activeIds, openItemIds, onOpenIt
|
|
|
6
6
|
activeIds: Set<string>;
|
|
7
7
|
openItemIds: Record<string, true>;
|
|
8
8
|
onOpenItemIdsChange: (nextOpenItemIds: Record<string, true>) => void;
|
|
9
|
-
attended:
|
|
9
|
+
attended: string[];
|
|
10
10
|
popoverAnchorId?: string;
|
|
11
11
|
}) => React.JSX.Element;
|
|
12
12
|
//# sourceMappingURL=NavTreeContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavTreeContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NavTreeContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAqBpE,OAAO,EAQL,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAM/C,eAAO,MAAM,gBAAgB,sFAO1B;IACD,IAAI,EAAE,oBAAoB,CAAC;IAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClC,mBAAmB,EAAE,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;IAErE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,sBA6UA,CAAC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
2
3
|
import { type JSX } from 'react';
|
|
3
|
-
import { type TreeProps } from './Tree';
|
|
4
|
-
declare const _default: {
|
|
5
|
-
title: string;
|
|
6
|
-
component: ({ className, showRoot, ...props }: TreeProps) => JSX.Element;
|
|
7
|
-
decorators: import("@storybook/react/*").Decorator[];
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
|
10
4
|
export declare const Default: () => JSX.Element;
|
|
11
5
|
export declare const Visitor: () => JSX.Element;
|
|
6
|
+
declare const meta: Meta;
|
|
7
|
+
export default meta;
|
|
12
8
|
//# sourceMappingURL=Tree.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.stories.d.ts","sourceRoot":"","sources":["../../../../src/experimental/Tree.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,
|
|
1
|
+
{"version":3,"file":"Tree.stories.d.ts","sourceRoot":"","sources":["../../../../src/experimental/Tree.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAc,EAAE,KAAK,GAAG,EAA+C,MAAM,OAAO,CAAC;AAmGrF,eAAO,MAAM,OAAO,mBAEnB,CAAC;AAEF,eAAO,MAAM,OAAO,mBAenB,CAAC;AAmGF,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,4BAA4B,CAAC;AAGxD,eAAO,MAAM,WAAW,eAAe,CAAC;;;;AAExC,wBAEuB"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: ({ id, items, current, attended, open, type, popoverAnchorId, onNavigate, onItemOpenChange, renderPresence, onOver, onDrop, onMove, onDragEnd, resolveItemLevel, indentation, loadDescendents, classNames, }: import("@dxos/react-ui-navtree").NavTreeProps) => React.JSX.Element;
|
|
6
|
-
decorators: import("@storybook/react/*").Decorator[];
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
9
4
|
export declare const Default: {
|
|
10
5
|
render: ({ debug }: {
|
|
11
6
|
debug?: boolean;
|
|
12
7
|
}) => React.JSX.Element;
|
|
13
8
|
};
|
|
9
|
+
declare const meta: Meta;
|
|
10
|
+
export default meta;
|
|
14
11
|
//# sourceMappingURL=Graph.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAA4B,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"Graph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAA4B,MAAM,OAAO,CAAC;AA+HjD,eAAO,MAAM,OAAO;wBACE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAMxC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-navtree",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14-main.2b6a0f3",
|
|
4
4
|
"description": "DXOS Surface plugin for a tree view visualization of the graph.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"browser": "./dist/lib/browser/index.mjs",
|
|
@@ -31,25 +32,26 @@
|
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@preact/signals-core": "^1.6.0",
|
|
33
34
|
"date-fns": "^3.3.1",
|
|
34
|
-
"@dxos/app-
|
|
35
|
-
"@dxos/app-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/local-storage": "0.6.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/plugin-graph": "0.6.
|
|
44
|
-
"@dxos/plugin-observability": "0.6.
|
|
45
|
-
"@dxos/plugin-theme": "0.6.
|
|
46
|
-
"@dxos/protocols": "0.6.
|
|
47
|
-
"@dxos/react-ui-deck": "0.6.
|
|
48
|
-
"@dxos/react-
|
|
49
|
-
"@dxos/react-
|
|
50
|
-
"@dxos/react-ui-navtree": "0.6.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-ui-searchlist": "0.6.
|
|
35
|
+
"@dxos/app-framework": "0.6.14-main.2b6a0f3",
|
|
36
|
+
"@dxos/app-graph": "0.6.14-main.2b6a0f3",
|
|
37
|
+
"@dxos/async": "0.6.14-main.2b6a0f3",
|
|
38
|
+
"@dxos/debug": "0.6.14-main.2b6a0f3",
|
|
39
|
+
"@dxos/keyboard": "0.6.14-main.2b6a0f3",
|
|
40
|
+
"@dxos/echo-schema": "0.6.14-main.2b6a0f3",
|
|
41
|
+
"@dxos/local-storage": "0.6.14-main.2b6a0f3",
|
|
42
|
+
"@dxos/plugin-client": "0.6.14-main.2b6a0f3",
|
|
43
|
+
"@dxos/log": "0.6.14-main.2b6a0f3",
|
|
44
|
+
"@dxos/plugin-graph": "0.6.14-main.2b6a0f3",
|
|
45
|
+
"@dxos/plugin-observability": "0.6.14-main.2b6a0f3",
|
|
46
|
+
"@dxos/plugin-theme": "0.6.14-main.2b6a0f3",
|
|
47
|
+
"@dxos/protocols": "0.6.14-main.2b6a0f3",
|
|
48
|
+
"@dxos/react-ui-deck": "0.6.14-main.2b6a0f3",
|
|
49
|
+
"@dxos/react-client": "0.6.14-main.2b6a0f3",
|
|
50
|
+
"@dxos/react-ui-mosaic": "0.6.14-main.2b6a0f3",
|
|
51
|
+
"@dxos/react-ui-navtree": "0.6.14-main.2b6a0f3",
|
|
52
|
+
"@dxos/react-ui-list": "0.6.14-main.2b6a0f3",
|
|
53
|
+
"@dxos/react-ui-searchlist": "0.6.14-main.2b6a0f3",
|
|
54
|
+
"@dxos/util": "0.6.14-main.2b6a0f3"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -57,19 +59,19 @@
|
|
|
57
59
|
"@types/react-dom": "~18.2.0",
|
|
58
60
|
"react": "~18.2.0",
|
|
59
61
|
"react-dom": "~18.2.0",
|
|
60
|
-
"vite": "
|
|
61
|
-
"@dxos/echo-signals": "0.6.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-ui
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/storybook-utils": "0.6.
|
|
62
|
+
"vite": "5.4.7",
|
|
63
|
+
"@dxos/echo-signals": "0.6.14-main.2b6a0f3",
|
|
64
|
+
"@dxos/random": "0.6.14-main.2b6a0f3",
|
|
65
|
+
"@dxos/react-ui": "0.6.14-main.2b6a0f3",
|
|
66
|
+
"@dxos/react-ui-theme": "0.6.14-main.2b6a0f3",
|
|
67
|
+
"@dxos/storybook-utils": "0.6.14-main.2b6a0f3"
|
|
66
68
|
},
|
|
67
69
|
"peerDependencies": {
|
|
68
70
|
"@phosphor-icons/react": "^2.1.5",
|
|
69
|
-
"react": "
|
|
70
|
-
"react-dom": "
|
|
71
|
-
"@dxos/react-ui": "0.6.
|
|
72
|
-
"@dxos/react-ui
|
|
71
|
+
"react": "~18.2.0",
|
|
72
|
+
"react-dom": "~18.2.0",
|
|
73
|
+
"@dxos/react-ui-theme": "0.6.14-main.2b6a0f3",
|
|
74
|
+
"@dxos/react-ui": "0.6.14-main.2b6a0f3"
|
|
73
75
|
},
|
|
74
76
|
"publishConfig": {
|
|
75
77
|
"access": "public"
|
package/src/NavTreePlugin.tsx
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { MagnifyingGlass, type IconProps } from '@phosphor-icons/react';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import {
|
|
@@ -155,7 +154,7 @@ export const NavTreePlugin = (): PluginDefinition<NavTreePluginProvides> => {
|
|
|
155
154
|
activeIds={data.activeIds as Set<string>}
|
|
156
155
|
openItemIds={state.values.openItemIds}
|
|
157
156
|
onOpenItemIdsChange={handleOpenItemIdsChange}
|
|
158
|
-
attended={data.attended as
|
|
157
|
+
attended={data.attended as string[]}
|
|
159
158
|
popoverAnchorId={data.popoverAnchorId as string}
|
|
160
159
|
/>
|
|
161
160
|
);
|
|
@@ -243,8 +242,7 @@ export const NavTreePlugin = (): PluginDefinition<NavTreePluginProvides> => {
|
|
|
243
242
|
},
|
|
244
243
|
properties: {
|
|
245
244
|
label: ['open commands label', { ns: NAVTREE_PLUGIN }],
|
|
246
|
-
icon:
|
|
247
|
-
iconSymbol: 'ph--magnifying-glass--regular',
|
|
245
|
+
icon: 'ph--magnifying-glass--regular',
|
|
248
246
|
keyBinding: {
|
|
249
247
|
macos: 'meta+k',
|
|
250
248
|
windows: 'ctrl+k',
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { DotOutline } from '@phosphor-icons/react';
|
|
6
5
|
import React, { useMemo, useState } from 'react';
|
|
7
6
|
|
|
8
7
|
import { useIntentDispatcher, LayoutAction } from '@dxos/app-framework';
|
|
9
8
|
import { type ActionLike, isActionGroup, isAction } from '@dxos/app-graph';
|
|
10
9
|
import { Keyboard, keySymbols } from '@dxos/keyboard';
|
|
11
10
|
import { useGraph } from '@dxos/plugin-graph';
|
|
12
|
-
import { Button, Dialog, useTranslation, toLocalizedString } from '@dxos/react-ui';
|
|
11
|
+
import { Button, Dialog, Icon, useTranslation, toLocalizedString } from '@dxos/react-ui';
|
|
13
12
|
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
14
13
|
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
15
14
|
import { getHostPlatform } from '@dxos/util';
|
|
@@ -70,7 +69,6 @@ export const CommandsDialogContent = ({ selected: initial }: { selected?: string
|
|
|
70
69
|
typeof action.properties.keyBinding === 'string'
|
|
71
70
|
? action.properties.keyBinding
|
|
72
71
|
: action.properties.keyBinding?.[getHostPlatform()];
|
|
73
|
-
const Icon = action.properties.icon ?? DotOutline;
|
|
74
72
|
return (
|
|
75
73
|
<SearchList.Item
|
|
76
74
|
value={label}
|
|
@@ -95,7 +93,7 @@ export const CommandsDialogContent = ({ selected: initial }: { selected?: string
|
|
|
95
93
|
disabled={action.properties.disabled}
|
|
96
94
|
{...(action.properties?.testId && { 'data-testid': action.properties.testId })}
|
|
97
95
|
>
|
|
98
|
-
<Icon
|
|
96
|
+
<Icon icon={action.properties.icon} size={4} />
|
|
99
97
|
<span className='grow truncate'>{label}</span>
|
|
100
98
|
{shortcut && <span className={mx('shrink-0', descriptionText)}>{keySymbols(shortcut).join('')}</span>}
|
|
101
99
|
</SearchList.Item>
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta } from '@storybook/react';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
10
|
import { HaloButton } from './HaloButton';
|
|
10
11
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
component: HaloButton,
|
|
14
|
-
actions: { argTypesRegex: '^on.*' },
|
|
12
|
+
export const Default = (props: any) => {
|
|
13
|
+
return <HaloButton {...props} />;
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const meta: Meta<typeof HaloButton> = {
|
|
17
|
+
title: 'plugins/plugin-navtree/HaloButton',
|
|
18
|
+
component: HaloButton,
|
|
19
19
|
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { DotsThreeVertical } from '@phosphor-icons/react';
|
|
6
5
|
import React, { Fragment } from 'react';
|
|
7
6
|
|
|
8
7
|
import { getGraph, type Node } from '@dxos/app-graph';
|
|
@@ -22,7 +21,6 @@ export const NavBarStart = ({ activeNode, popoverAnchorId }: { activeNode: Node;
|
|
|
22
21
|
? Popover.Anchor
|
|
23
22
|
: Fragment;
|
|
24
23
|
|
|
25
|
-
const Icon = activeNode.properties?.icon ?? DotsThreeVertical;
|
|
26
24
|
const graph = getGraph(activeNode);
|
|
27
25
|
const actions = graph.actions(activeNode);
|
|
28
26
|
const label = toLocalizedString(activeNode.properties?.label, t);
|
|
@@ -33,10 +31,10 @@ export const NavBarStart = ({ activeNode, popoverAnchorId }: { activeNode: Node;
|
|
|
33
31
|
<>
|
|
34
32
|
<ActionRoot>
|
|
35
33
|
<PlankHeading.ActionsMenu
|
|
36
|
-
|
|
34
|
+
icon={activeNode.properties?.icon ?? 'ph--dots-three-vertical--regular'}
|
|
37
35
|
attendableId={activeNode.id}
|
|
38
36
|
triggerLabel={menuTriggerLabel}
|
|
39
|
-
actions={actions}
|
|
37
|
+
actions={[actions]}
|
|
40
38
|
onAction={(action) =>
|
|
41
39
|
typeof action.data === 'function' && action.data({ node: action as Node, caller: TREE_ITEM_MAIN_HEADING })
|
|
42
40
|
}
|
|
@@ -4,26 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type ReactNode, useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
NavigationAction,
|
|
9
|
-
LayoutAction,
|
|
10
|
-
Surface,
|
|
11
|
-
SLUG_PATH_SEPARATOR,
|
|
12
|
-
SLUG_COLLECTION_INDICATOR,
|
|
13
|
-
useIntentDispatcher,
|
|
14
|
-
} from '@dxos/app-framework';
|
|
7
|
+
import { NavigationAction, Surface, useIntentDispatcher } from '@dxos/app-framework';
|
|
15
8
|
import { getGraph, isAction, isActionLike } from '@dxos/app-graph';
|
|
16
9
|
import { ElevationProvider, useMediaQuery, useSidebars } from '@dxos/react-ui';
|
|
17
|
-
import {
|
|
10
|
+
import { List } from '@dxos/react-ui-list';
|
|
11
|
+
import { type MosaicDropEvent, type MosaicMoveEvent, Mosaic, Path } from '@dxos/react-ui-mosaic';
|
|
18
12
|
import {
|
|
13
|
+
getLevel,
|
|
19
14
|
NavTree,
|
|
15
|
+
type NavTreeActionsNode,
|
|
16
|
+
type NavTreeItemMoveDetails,
|
|
20
17
|
type NavTreeItemNode,
|
|
21
18
|
type NavTreeNode,
|
|
22
|
-
getLevel,
|
|
23
|
-
type NavTreeActionsNode,
|
|
24
19
|
type NavTreeProps,
|
|
25
|
-
type NavTreeItemMoveDetails,
|
|
26
20
|
} from '@dxos/react-ui-navtree';
|
|
21
|
+
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
27
22
|
import { arrayMove } from '@dxos/util';
|
|
28
23
|
|
|
29
24
|
import { NavTreeFooter } from './NavTreeFooter';
|
|
@@ -33,10 +28,10 @@ import {
|
|
|
33
28
|
expandChildren,
|
|
34
29
|
getChildren,
|
|
35
30
|
getParent,
|
|
36
|
-
type NavTreeItem,
|
|
37
|
-
type NavTreeItemGraphNode,
|
|
38
31
|
resolveMigrationOperation,
|
|
39
32
|
treeItemsFromRootNode,
|
|
33
|
+
type NavTreeItem,
|
|
34
|
+
type NavTreeItemGraphNode,
|
|
40
35
|
} from '../util';
|
|
41
36
|
|
|
42
37
|
// TODO(thure): Is NavTree truly authoritative in this regard?
|
|
@@ -58,7 +53,8 @@ export const NavTreeContainer = ({
|
|
|
58
53
|
activeIds: Set<string>;
|
|
59
54
|
openItemIds: Record<string, true>;
|
|
60
55
|
onOpenItemIdsChange: (nextOpenItemIds: Record<string, true>) => void;
|
|
61
|
-
|
|
56
|
+
// TODO(wittjosiah): Use attention context directly?
|
|
57
|
+
attended: string[];
|
|
62
58
|
popoverAnchorId?: string;
|
|
63
59
|
}) => {
|
|
64
60
|
const { closeNavigationSidebar } = useSidebars(NAVTREE_PLUGIN);
|
|
@@ -66,7 +62,6 @@ export const NavTreeContainer = ({
|
|
|
66
62
|
const dispatch = useIntentDispatcher();
|
|
67
63
|
|
|
68
64
|
const graph = useMemo(() => getGraph(root), [root]);
|
|
69
|
-
|
|
70
65
|
const items = treeItemsFromRootNode(graph, root, openItemIds);
|
|
71
66
|
|
|
72
67
|
const loadDescendents = useCallback(
|
|
@@ -96,19 +91,12 @@ export const NavTreeContainer = ({
|
|
|
96
91
|
await dispatch({
|
|
97
92
|
action: NavigationAction.OPEN,
|
|
98
93
|
data: {
|
|
99
|
-
activeParts:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
complementary: [`${node.id}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`],
|
|
103
|
-
}
|
|
104
|
-
: {
|
|
105
|
-
main: [node.id],
|
|
106
|
-
},
|
|
94
|
+
activeParts: {
|
|
95
|
+
main: [node.id],
|
|
96
|
+
},
|
|
107
97
|
},
|
|
108
98
|
});
|
|
109
99
|
|
|
110
|
-
await dispatch({ action: LayoutAction.SCROLL_INTO_VIEW, data: { id: node.id } });
|
|
111
|
-
|
|
112
100
|
const defaultAction = actions?.find((action) => action.properties?.disposition === 'default');
|
|
113
101
|
if (isAction(defaultAction)) {
|
|
114
102
|
void (defaultAction.data as () => void)();
|
|
@@ -161,7 +149,6 @@ export const NavTreeContainer = ({
|
|
|
161
149
|
({ active, over, details }: MosaicMoveEvent<number, NavTreeItemMoveDetails>) => {
|
|
162
150
|
const levelOffset = Math.floor((details?.delta?.x ?? 0) / 16);
|
|
163
151
|
const overPosition = over.position ?? 0;
|
|
164
|
-
|
|
165
152
|
const nextItems = arrayMove(
|
|
166
153
|
items,
|
|
167
154
|
items.findIndex(({ id }) => id === active.item.id),
|
|
@@ -170,9 +157,7 @@ export const NavTreeContainer = ({
|
|
|
170
157
|
|
|
171
158
|
const previousItem: NavTreeItem | undefined = nextItems[overPosition - 1];
|
|
172
159
|
const nextItem: NavTreeItem | undefined = nextItems[overPosition + 1];
|
|
173
|
-
|
|
174
160
|
const activeNode = 'node' in active.item ? (active.item as NavTreeItem).node : undefined;
|
|
175
|
-
|
|
176
161
|
if (!activeNode || !previousItem || !previousItem.path) {
|
|
177
162
|
// console.log('[reject]', !activeNode, !previousItem, !previousItem.path);
|
|
178
163
|
// log.warn('Top-level rearrange before the first item of the NavTree is unsupported at this time.');
|
|
@@ -180,11 +165,8 @@ export const NavTreeContainer = ({
|
|
|
180
165
|
}
|
|
181
166
|
|
|
182
167
|
const overLevel = resolveItemLevel(overPosition, active.item.id, levelOffset);
|
|
183
|
-
|
|
184
168
|
const previousLevel = getLevel(previousItem.path);
|
|
185
|
-
|
|
186
169
|
// console.log('[over]', overLevel, previousLevel, levelOffset);
|
|
187
|
-
|
|
188
170
|
if (previousLevel === overLevel - 1) {
|
|
189
171
|
if (Path.hasChild(previousItem.id, active.item.id)) {
|
|
190
172
|
// Previous is already parent of Active, rearrange.
|
|
@@ -251,9 +233,9 @@ export const NavTreeContainer = ({
|
|
|
251
233
|
if (Path.first(over.path) !== root.id) {
|
|
252
234
|
return undefined;
|
|
253
235
|
}
|
|
236
|
+
|
|
254
237
|
const { levelOffset = 0 } = details;
|
|
255
238
|
const overPosition = over.position ?? 0;
|
|
256
|
-
|
|
257
239
|
const nextItems = arrayMove(
|
|
258
240
|
items,
|
|
259
241
|
items.findIndex(({ id }) => id === active.item.id),
|
|
@@ -262,13 +244,11 @@ export const NavTreeContainer = ({
|
|
|
262
244
|
|
|
263
245
|
const activeNode = 'node' in active.item ? (active.item as NavTreeItem).node : undefined;
|
|
264
246
|
const activeParentId = Path.parent(active.item.id);
|
|
265
|
-
|
|
266
247
|
if (!activeNode) {
|
|
267
248
|
return undefined;
|
|
268
249
|
}
|
|
269
250
|
|
|
270
251
|
const activeParent = getParent(graph, activeNode, (active.item as NavTreeItem).path ?? []);
|
|
271
|
-
|
|
272
252
|
if (operation === 'rearrange') {
|
|
273
253
|
void activeParent?.properties.onRearrangeChildren?.(
|
|
274
254
|
nextItems.filter(({ id }) => Path.hasChild(activeParentId, id)).map(({ node }) => node.data),
|
|
@@ -277,11 +257,8 @@ export const NavTreeContainer = ({
|
|
|
277
257
|
} else {
|
|
278
258
|
const previousItem: NavTreeItem | undefined = nextItems[overPosition - 1];
|
|
279
259
|
const nextItem: NavTreeItem | undefined = nextItems[overPosition + 1];
|
|
280
|
-
|
|
281
260
|
const overLevel = resolveItemLevel(overPosition, active.item.id, levelOffset);
|
|
282
|
-
|
|
283
261
|
const previousLevel = getLevel(previousItem.path);
|
|
284
|
-
|
|
285
262
|
if (operation === 'copy') {
|
|
286
263
|
if (previousLevel === overLevel - 1) {
|
|
287
264
|
void previousItem.node.properties.onCopy?.(activeNode, 0);
|
|
@@ -344,35 +321,72 @@ export const NavTreeContainer = ({
|
|
|
344
321
|
onOpenItemIdsChange({ ...openItemIds });
|
|
345
322
|
}, [onOpenItemIdsChange, openItemIds]);
|
|
346
323
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
324
|
+
// TODO(burdon): Remove.
|
|
325
|
+
// Debug list.
|
|
326
|
+
const debug = false;
|
|
327
|
+
if (debug) {
|
|
328
|
+
const getLabel = (item: NavTreeItem) => {
|
|
329
|
+
const label = item.node?.properties?.label;
|
|
330
|
+
return typeof label === 'string' ? label : item.id;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
<div className='bs-full overflow-hidden row-span-3 grid grid-cols-1 grid-rows-[min-content_1fr_min-content]'>
|
|
335
|
+
<div className='flex items-center p-2'>Items: {items.length}</div>
|
|
355
336
|
<div role='none' className='!overflow-y-auto'>
|
|
356
|
-
<
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
renderPresence={renderPresence}
|
|
370
|
-
resolveItemLevel={resolveItemLevel}
|
|
371
|
-
loadDescendents={loadDescendents}
|
|
372
|
-
/>
|
|
337
|
+
<List.Root<NavTreeItem> items={items} isItem={() => true}>
|
|
338
|
+
{({ items }) =>
|
|
339
|
+
items.map((item) => (
|
|
340
|
+
<List.Item<NavTreeItem> key={item.id} item={item} classNames={mx('p-2', ghostHover)}>
|
|
341
|
+
<List.ItemDragHandle />
|
|
342
|
+
<List.ItemTitle classNames='p-2 text-sm' onClick={() => handleNavigate(item)}>
|
|
343
|
+
{getLabel(item)}
|
|
344
|
+
</List.ItemTitle>
|
|
345
|
+
<List.IconButton icon='ph--caret-down--regular' onClick={() => handleItemOpenChange(item, true)} />
|
|
346
|
+
</List.Item>
|
|
347
|
+
))
|
|
348
|
+
}
|
|
349
|
+
</List.Root>
|
|
373
350
|
</div>
|
|
374
351
|
<NavTreeFooter />
|
|
375
352
|
</div>
|
|
376
|
-
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return (
|
|
357
|
+
<Mosaic.Root>
|
|
358
|
+
<Mosaic.DragOverlay />
|
|
359
|
+
<ElevationProvider elevation='chrome'>
|
|
360
|
+
<div
|
|
361
|
+
role='none'
|
|
362
|
+
className='bs-full overflow-hidden row-span-3 grid grid-cols-1 grid-rows-[min-content_1fr_min-content]'
|
|
363
|
+
>
|
|
364
|
+
<Surface role='search-input' limit={1} />
|
|
365
|
+
|
|
366
|
+
{/* TODO(thure): what gives this an inline `overflow: initial`? */}
|
|
367
|
+
<div role='none' className='!overflow-y-auto'>
|
|
368
|
+
<NavTree
|
|
369
|
+
id={root.id}
|
|
370
|
+
items={items}
|
|
371
|
+
current={activeIds}
|
|
372
|
+
attended={attended}
|
|
373
|
+
type={NODE_TYPE}
|
|
374
|
+
loadDescendents={loadDescendents}
|
|
375
|
+
popoverAnchorId={popoverAnchorId}
|
|
376
|
+
renderPresence={renderPresence}
|
|
377
|
+
resolveItemLevel={resolveItemLevel}
|
|
378
|
+
open={openItemIds}
|
|
379
|
+
onNavigate={handleNavigate}
|
|
380
|
+
onItemOpenChange={handleItemOpenChange}
|
|
381
|
+
onMove={handleMove}
|
|
382
|
+
onDrop={handleDrop}
|
|
383
|
+
onDragEnd={handleDragEnd}
|
|
384
|
+
/>
|
|
385
|
+
</div>
|
|
386
|
+
|
|
387
|
+
<NavTreeFooter />
|
|
388
|
+
</div>
|
|
389
|
+
</ElevationProvider>
|
|
390
|
+
</Mosaic.Root>
|
|
377
391
|
);
|
|
378
392
|
};
|
|
@@ -35,7 +35,7 @@ const buttonStyles = 'pli-1.5 text-xs font-normal';
|
|
|
35
35
|
const repo = 'https://github.com/dxos/dxos';
|
|
36
36
|
|
|
37
37
|
export const NavTreeFooter = (props: { layoutPart?: LayoutPart }) => {
|
|
38
|
-
const layoutPart = useDefaultValue(props.layoutPart, 'sidebar');
|
|
38
|
+
const layoutPart = useDefaultValue(props.layoutPart, () => 'sidebar');
|
|
39
39
|
const config = useConfig();
|
|
40
40
|
const { t } = useTranslation(NAVTREE_PLUGIN);
|
|
41
41
|
const { navigationSidebarOpen } = useSidebars(NAVTREE_PLUGIN);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
7
|
import { House, List, Planet, PlusCircle, Sailboat } from '@phosphor-icons/react';
|
|
8
|
+
import { type Meta } from '@storybook/react';
|
|
8
9
|
import React, { type JSX, type PropsWithChildren, useEffect, useState } from 'react';
|
|
9
10
|
|
|
10
11
|
import { faker } from '@dxos/random';
|
|
@@ -15,12 +16,6 @@ import { type ItemMap, Tree, type TreeNodeData, type TreeProps, visitNodes, visi
|
|
|
15
16
|
|
|
16
17
|
faker.seed(1234);
|
|
17
18
|
|
|
18
|
-
export default {
|
|
19
|
-
title: 'plugin-navtree/Tree',
|
|
20
|
-
component: Tree,
|
|
21
|
-
decorators: [withTheme, withLayout({ fullscreen: true, classNames: modalSurface })],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
19
|
/**
|
|
25
20
|
* Space:
|
|
26
21
|
* - Space panels are separated from each other to give them more weight than folders.
|
|
@@ -47,11 +42,11 @@ const Container = ({ children, sidebar }: PropsWithChildren<{ sidebar: JSX.Eleme
|
|
|
47
42
|
const data: TreeNodeData[] = [
|
|
48
43
|
{
|
|
49
44
|
id: 'root',
|
|
50
|
-
title: 'Root',
|
|
45
|
+
title: 'plugins/Root',
|
|
51
46
|
children: [
|
|
52
47
|
{
|
|
53
48
|
id: faker.string.uuid(),
|
|
54
|
-
title: 'Personal Space',
|
|
49
|
+
title: 'plugins/Personal Space',
|
|
55
50
|
color: 'text-green-400',
|
|
56
51
|
Icon: House,
|
|
57
52
|
children: [
|
|
@@ -227,3 +222,11 @@ const Sidebar = ({ mutate }: { mutate?: boolean }) => {
|
|
|
227
222
|
</div>
|
|
228
223
|
);
|
|
229
224
|
};
|
|
225
|
+
|
|
226
|
+
const meta: Meta = {
|
|
227
|
+
title: 'plugins/plugin-navtree/Tree',
|
|
228
|
+
component: Tree,
|
|
229
|
+
decorators: [withTheme, withLayout({ fullscreen: true, classNames: modalSurface })],
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export default meta;
|
|
@@ -6,7 +6,7 @@ import { CaretRight, Circle, File, Folder, type Icon, type IconProps, Plus, User
|
|
|
6
6
|
import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type ClassNameValue, type Size } from '@dxos/react-ui';
|
|
9
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
+
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
11
|
// TODO(burdon): Rounded border if first/last.
|
|
12
12
|
const styles = {
|
|
@@ -29,7 +29,7 @@ export const IconButton = ({
|
|
|
29
29
|
// TODO(burdon): Density aware.
|
|
30
30
|
return (
|
|
31
31
|
<div className={mx('flex w-6 h-6 items-center justify-center select-none', classNames)} onClick={onClick}>
|
|
32
|
-
<Icon
|
|
32
|
+
<Icon className={mx('cursor-pointer', getSize(size))} {...props} />
|
|
33
33
|
</div>
|
|
34
34
|
);
|
|
35
35
|
};
|
package/src/meta.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
+
|
|
5
7
|
export const NAVTREE_PLUGIN = 'dxos.org/plugin/navtree';
|
|
6
8
|
|
|
7
9
|
// TODO(wittjosiah): Factor out.
|
|
@@ -9,4 +11,4 @@ export const KEY_BINDING = 'KeyBinding';
|
|
|
9
11
|
|
|
10
12
|
export default {
|
|
11
13
|
id: NAVTREE_PLUGIN,
|
|
12
|
-
};
|
|
14
|
+
} satisfies PluginMeta;
|