@dxos/plugin-navtree 0.9.0 → 0.9.1-main.c7dcc2e112
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/neutral/{CommandsDialogContent-UBGIQ5FI.mjs → CommandsDialogContent-TEKBCQ3U.mjs} +3 -3
- package/dist/lib/neutral/CommandsDialogContent-TEKBCQ3U.mjs.map +7 -0
- package/dist/lib/neutral/{CommandsTrigger-BH5WLMHK.mjs → CommandsTrigger-HGCI22SP.mjs} +2 -2
- package/dist/lib/neutral/{CommandsTrigger-BH5WLMHK.mjs.map → CommandsTrigger-HGCI22SP.mjs.map} +3 -3
- package/dist/lib/neutral/{NavTreeContainer-6AR4BFDD.mjs → NavTreeContainer-QIWROTCL.mjs} +2 -2
- package/dist/lib/neutral/{NavTreeDocumentTitle-H3E6ZLYE.mjs → NavTreeDocumentTitle-RMERXZGK.mjs} +2 -2
- package/dist/lib/neutral/{NavTreeDocumentTitle-H3E6ZLYE.mjs.map → NavTreeDocumentTitle-RMERXZGK.mjs.map} +3 -3
- package/dist/lib/neutral/NavTreePlugin.mjs +2 -2
- package/dist/lib/neutral/NavTreePlugin.mjs.map +4 -4
- package/dist/lib/neutral/{app-graph-builder-Z347LKSF.mjs → app-graph-builder-2DYAIROU.mjs} +2 -2
- package/dist/lib/neutral/{app-graph-builder-Z347LKSF.mjs.map → app-graph-builder-2DYAIROU.mjs.map} +3 -3
- package/dist/lib/neutral/capabilities/index.mjs +3 -3
- package/dist/lib/neutral/{chunk-ZSWYB7JW.mjs → chunk-BAVI2K7A.mjs} +3 -3
- package/dist/lib/neutral/{chunk-ZSWYB7JW.mjs.map → chunk-BAVI2K7A.mjs.map} +3 -3
- package/dist/lib/neutral/{chunk-T7QS2EFI.mjs → chunk-EAN4K6OL.mjs} +2 -2
- package/dist/lib/neutral/chunk-IRQMJLRY.mjs +45 -0
- package/dist/lib/neutral/chunk-IRQMJLRY.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-5OPDKH6B.mjs → chunk-UBVNITFG.mjs} +4 -4
- package/dist/lib/neutral/chunk-UBVNITFG.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +44 -37
- package/dist/lib/neutral/components/index.mjs.map +3 -3
- package/dist/lib/neutral/containers/index.mjs +5 -5
- package/dist/lib/neutral/{expose-26FV4W5D.mjs → expose-HIBA2NQG.mjs} +2 -2
- package/dist/lib/neutral/index.mjs +2 -2
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{react-surface-Q5XMAG7Z.mjs → react-surface-N4EESW3L.mjs} +9 -12
- package/dist/lib/neutral/{react-surface-Q5XMAG7Z.mjs.map → react-surface-N4EESW3L.mjs.map} +3 -3
- package/dist/lib/neutral/{state-VVJEWUHM.mjs → state-PDZU4PIP.mjs} +2 -2
- package/dist/lib/neutral/state-PDZU4PIP.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +1 -1
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +1 -1
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +28 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types/NavTreeCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/NavTreeEvents.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +31 -0
- package/package.json +33 -32
- package/src/NavTreePlugin.test.ts +1 -1
- package/src/NavTreePlugin.tsx +1 -1
- package/src/capabilities/app-graph-builder.ts +1 -1
- package/src/capabilities/react-surface.tsx +6 -13
- package/src/capabilities/state.ts +1 -1
- package/src/components/NavTree/NavTree.tsx +2 -1
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +5 -3
- package/src/components/Sidebar/L0Menu.tsx +4 -4
- package/src/components/Sidebar/L1Panel.tsx +5 -5
- package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +2 -2
- package/src/containers/CommandsTrigger/CommandsTrigger.tsx +1 -1
- package/src/containers/NavTreeContainer/NavTreeContainer.tsx +3 -3
- package/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.tsx +1 -1
- package/src/meta.ts +3 -23
- package/src/translations.ts +1 -1
- package/src/types/NavTreeCapabilities.ts +1 -1
- package/src/types/NavTreeEvents.ts +1 -1
- package/dist/lib/neutral/CommandsDialogContent-UBGIQ5FI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-5OPDKH6B.mjs.map +0 -7
- package/dist/lib/neutral/chunk-MDGKDQMZ.mjs +0 -37
- package/dist/lib/neutral/chunk-MDGKDQMZ.mjs.map +0 -7
- package/dist/lib/neutral/state-VVJEWUHM.mjs.map +0 -7
- /package/dist/lib/neutral/{NavTreeContainer-6AR4BFDD.mjs.map → NavTreeContainer-QIWROTCL.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-T7QS2EFI.mjs.map → chunk-EAN4K6OL.mjs.map} +0 -0
- /package/dist/lib/neutral/{expose-26FV4W5D.mjs.map → expose-HIBA2NQG.mjs.map} +0 -0
package/dx.config.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Config2 } from '@dxos/app-framework/config';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
7
|
+
|
|
8
|
+
export default Config2.make({
|
|
9
|
+
plugin: {
|
|
10
|
+
key: 'org.dxos.plugin.navtree',
|
|
11
|
+
name: 'Navtree',
|
|
12
|
+
author: 'DXOS',
|
|
13
|
+
description: trim`
|
|
14
|
+
NavTreePlugin renders the application graph as a collapsible hierarchical tree in the Composer sidebar.
|
|
15
|
+
It manages workspace tabs at the root level and provides expand/collapse navigation for spaces, folders,
|
|
16
|
+
and objects, with open/current state persisted to localStorage across sessions.
|
|
17
|
+
|
|
18
|
+
The plugin wires drag-and-drop rearrangement and cross-parent transfer of tree items via Pragmatic DnD,
|
|
19
|
+
and registers graph-action keyboard shortcuts (including the ⌘K / Ctrl+K command palette) through a
|
|
20
|
+
global Keyboard singleton that tracks context as the user navigates.
|
|
21
|
+
|
|
22
|
+
An operation handler for LayoutOperation.Expose expands ancestor paths on demand so that any
|
|
23
|
+
programmatically activated item is scrolled into view in the tree.
|
|
24
|
+
|
|
25
|
+
A commands dialog surfaces all discoverable graph actions as a searchable palette, making it the primary
|
|
26
|
+
keyboard-first entry point for power users.
|
|
27
|
+
`,
|
|
28
|
+
spec: 'PLUGIN.mdl',
|
|
29
|
+
tags: ['system'],
|
|
30
|
+
},
|
|
31
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-navtree",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-main.c7dcc2e112",
|
|
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",
|
|
@@ -91,33 +91,34 @@
|
|
|
91
91
|
"types": "dist/types/src/index.d.ts",
|
|
92
92
|
"files": [
|
|
93
93
|
"dist",
|
|
94
|
+
"dx.config.ts",
|
|
94
95
|
"src",
|
|
95
96
|
"PLUGIN.mdl"
|
|
96
97
|
],
|
|
97
98
|
"dependencies": {
|
|
98
99
|
"@atlaskit/pragmatic-drag-and-drop": "1.7.7",
|
|
99
100
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
|
|
100
|
-
"@dxos/app-
|
|
101
|
-
"@dxos/app-
|
|
102
|
-
"@dxos/
|
|
103
|
-
"@dxos/
|
|
104
|
-
"@dxos/
|
|
105
|
-
"@dxos/
|
|
106
|
-
"@dxos/
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/
|
|
109
|
-
"@dxos/
|
|
110
|
-
"@dxos/
|
|
111
|
-
"@dxos/
|
|
112
|
-
"@dxos/
|
|
113
|
-
"@dxos/
|
|
114
|
-
"@dxos/react-ui-
|
|
115
|
-
"@dxos/react-ui-
|
|
116
|
-
"@dxos/react-ui-
|
|
117
|
-
"@dxos/react-ui-
|
|
118
|
-
"@dxos/
|
|
119
|
-
"@dxos/react-ui-
|
|
120
|
-
"@dxos/
|
|
101
|
+
"@dxos/app-framework": "0.9.1-main.c7dcc2e112",
|
|
102
|
+
"@dxos/app-toolkit": "0.9.1-main.c7dcc2e112",
|
|
103
|
+
"@dxos/app-graph": "0.9.1-main.c7dcc2e112",
|
|
104
|
+
"@dxos/async": "0.9.1-main.c7dcc2e112",
|
|
105
|
+
"@dxos/compute": "0.9.1-main.c7dcc2e112",
|
|
106
|
+
"@dxos/debug": "0.9.1-main.c7dcc2e112",
|
|
107
|
+
"@dxos/keys": "0.9.1-main.c7dcc2e112",
|
|
108
|
+
"@dxos/lit-ui": "0.9.1-main.c7dcc2e112",
|
|
109
|
+
"@dxos/echo": "0.9.1-main.c7dcc2e112",
|
|
110
|
+
"@dxos/log": "0.9.1-main.c7dcc2e112",
|
|
111
|
+
"@dxos/plugin-deck": "0.9.1-main.c7dcc2e112",
|
|
112
|
+
"@dxos/random": "0.9.1-main.c7dcc2e112",
|
|
113
|
+
"@dxos/react-ui-attention": "0.9.1-main.c7dcc2e112",
|
|
114
|
+
"@dxos/plugin-graph": "0.9.1-main.c7dcc2e112",
|
|
115
|
+
"@dxos/react-ui-list": "0.9.1-main.c7dcc2e112",
|
|
116
|
+
"@dxos/react-ui-menu": "0.9.1-main.c7dcc2e112",
|
|
117
|
+
"@dxos/react-ui-search": "0.9.1-main.c7dcc2e112",
|
|
118
|
+
"@dxos/react-ui-stack": "0.9.1-main.c7dcc2e112",
|
|
119
|
+
"@dxos/util": "0.9.1-main.c7dcc2e112",
|
|
120
|
+
"@dxos/react-ui-tabs": "0.9.1-main.c7dcc2e112",
|
|
121
|
+
"@dxos/keyboard": "0.9.1-main.c7dcc2e112"
|
|
121
122
|
},
|
|
122
123
|
"devDependencies": {
|
|
123
124
|
"@effect-atom/atom-react": "^0.5.0",
|
|
@@ -128,14 +129,14 @@
|
|
|
128
129
|
"react": "~19.2.3",
|
|
129
130
|
"react-dom": "~19.2.3",
|
|
130
131
|
"vite": "^8.0.16",
|
|
131
|
-
"@dxos/plugin-
|
|
132
|
-
"@dxos/plugin-
|
|
133
|
-
"@dxos/plugin-
|
|
134
|
-
"@dxos/plugin-
|
|
135
|
-
"@dxos/
|
|
136
|
-
"@dxos/
|
|
137
|
-
"@dxos/ui-theme": "0.9.
|
|
138
|
-
"@dxos/storybook-utils": "0.9.
|
|
132
|
+
"@dxos/plugin-client": "0.9.1-main.c7dcc2e112",
|
|
133
|
+
"@dxos/plugin-space": "0.9.1-main.c7dcc2e112",
|
|
134
|
+
"@dxos/plugin-attention": "0.9.1-main.c7dcc2e112",
|
|
135
|
+
"@dxos/plugin-testing": "0.9.1-main.c7dcc2e112",
|
|
136
|
+
"@dxos/plugin-theme": "0.9.1-main.c7dcc2e112",
|
|
137
|
+
"@dxos/react-ui": "0.9.1-main.c7dcc2e112",
|
|
138
|
+
"@dxos/ui-theme": "0.9.1-main.c7dcc2e112",
|
|
139
|
+
"@dxos/storybook-utils": "0.9.1-main.c7dcc2e112"
|
|
139
140
|
},
|
|
140
141
|
"peerDependencies": {
|
|
141
142
|
"@effect-atom/atom-react": "^0.5.0",
|
|
@@ -143,8 +144,8 @@
|
|
|
143
144
|
"effect": "3.21.3",
|
|
144
145
|
"react": "~19.2.3",
|
|
145
146
|
"react-dom": "~19.2.3",
|
|
146
|
-
"@dxos/
|
|
147
|
-
"@dxos/ui
|
|
147
|
+
"@dxos/ui-theme": "0.9.1-main.c7dcc2e112",
|
|
148
|
+
"@dxos/react-ui": "0.9.1-main.c7dcc2e112"
|
|
148
149
|
},
|
|
149
150
|
"publishConfig": {
|
|
150
151
|
"access": "public"
|
|
@@ -11,7 +11,7 @@ import { NavTreePlugin } from '#plugin';
|
|
|
11
11
|
|
|
12
12
|
import { meta } from './meta';
|
|
13
13
|
|
|
14
|
-
const moduleId = (name: string) => `${meta.
|
|
14
|
+
const moduleId = (name: string) => `${meta.profile.key}.module.${name}`;
|
|
15
15
|
|
|
16
16
|
describe('NavTreePlugin', () => {
|
|
17
17
|
test('modules activate on the expected events', async ({ expect }) => {
|
package/src/NavTreePlugin.tsx
CHANGED
|
@@ -56,7 +56,7 @@ export const NavTreePlugin = Plugin.define(meta).pipe(
|
|
|
56
56
|
activate: Keyboard,
|
|
57
57
|
}),
|
|
58
58
|
AppPlugin.addPluginAssetModule({
|
|
59
|
-
asset: { pluginId: meta.
|
|
59
|
+
asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },
|
|
60
60
|
}),
|
|
61
61
|
Plugin.make,
|
|
62
62
|
);
|
|
@@ -26,7 +26,7 @@ export default Capability.makeModule(
|
|
|
26
26
|
blockAlign: 'start',
|
|
27
27
|
}),
|
|
28
28
|
properties: {
|
|
29
|
-
label: ['open-commands.label', { ns: meta.
|
|
29
|
+
label: ['open-commands.label', { ns: meta.profile.key }],
|
|
30
30
|
icon: 'ph--magnifying-glass--regular',
|
|
31
31
|
keyBinding: {
|
|
32
32
|
macos: 'meta+k',
|
|
@@ -23,28 +23,21 @@ export default Capability.makeModule(() =>
|
|
|
23
23
|
}),
|
|
24
24
|
Surface.create({
|
|
25
25
|
id: 'navigation',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<NavTreeContainer
|
|
31
|
-
tab={data.current}
|
|
32
|
-
popoverAnchorId={data.popoverAnchorId as string | undefined}
|
|
33
|
-
ref={ref}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
},
|
|
26
|
+
filter: Surface.makeFilter(AppSurface.Navigation),
|
|
27
|
+
component: ({ data, ref }) => (
|
|
28
|
+
<NavTreeContainer tab={data.current} popoverAnchorId={data.popoverAnchorId} ref={ref} />
|
|
29
|
+
),
|
|
37
30
|
}),
|
|
38
31
|
Surface.create({
|
|
39
32
|
id: 'documentTitle',
|
|
40
|
-
|
|
33
|
+
filter: Surface.makeFilter(AppSurface.DocumentTitle),
|
|
41
34
|
component: ({ data }) => (
|
|
42
35
|
<NavTreeDocumentTitle node={Node.isGraphNode(data.subject) ? data.subject : undefined} />
|
|
43
36
|
),
|
|
44
37
|
}),
|
|
45
38
|
Surface.create({
|
|
46
39
|
id: 'searchInput',
|
|
47
|
-
|
|
40
|
+
filter: Surface.makeFilter(AppSurface.SearchInput),
|
|
48
41
|
position: 'last',
|
|
49
42
|
component: () => <CommandsTrigger />,
|
|
50
43
|
}),
|
|
@@ -13,7 +13,7 @@ import { Path } from '@dxos/react-ui-list';
|
|
|
13
13
|
import { meta } from '#meta';
|
|
14
14
|
import { NavTreeCapabilities } from '#types';
|
|
15
15
|
|
|
16
|
-
const KEY = `${meta.
|
|
16
|
+
const KEY = `${meta.profile.key}.state.v1`;
|
|
17
17
|
|
|
18
18
|
/** Default item state for new entries. */
|
|
19
19
|
const defaultItemState: NavTreeCapabilities.NavTreeItemState = { open: false, current: false };
|
|
@@ -6,6 +6,7 @@ import React, { forwardRef, useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
8
8
|
import { Node, useConnections, useActions as useGraphActions } from '@dxos/plugin-graph';
|
|
9
|
+
import { type MenuItem } from '@dxos/react-ui-menu';
|
|
9
10
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
10
11
|
import { byPosition } from '@dxos/util';
|
|
11
12
|
|
|
@@ -33,7 +34,7 @@ export const NavTree = forwardRef<HTMLDivElement, NavTreeProps>(({ id, root, tab
|
|
|
33
34
|
// not use `react-ui-tabs` at all.
|
|
34
35
|
<Tabs.Root value={tab} orientation='vertical' classNames='relative' ref={forwardedRef}>
|
|
35
36
|
<L0Menu
|
|
36
|
-
menuActions={topLevelActions}
|
|
37
|
+
menuActions={topLevelActions as MenuItem[]}
|
|
37
38
|
topLevelItems={l0Items}
|
|
38
39
|
pinnedItems={pinnedItems}
|
|
39
40
|
userAccountItem={userAccountItem}
|
|
@@ -36,7 +36,7 @@ export type NavTreeItemActionMenuProps = ActionProperties & {
|
|
|
36
36
|
|
|
37
37
|
export const NavTreeItemActionDropdownMenu = composable<HTMLButtonElement, NavTreeItemActionMenuProps>(
|
|
38
38
|
({ parent, path, label, icon, testId, menuActions, caller, ...props }, forwardedRef) => {
|
|
39
|
-
const { t } = useTranslation(meta.
|
|
39
|
+
const { t } = useTranslation(meta.profile.key);
|
|
40
40
|
const density = useDensityContext();
|
|
41
41
|
const runAction = useActionRunner();
|
|
42
42
|
const handleAction = useCallback(
|
|
@@ -118,7 +118,7 @@ export const NavTreeItemAction = ({
|
|
|
118
118
|
path,
|
|
119
119
|
...props
|
|
120
120
|
}: NavTreeItemActionMenuProps) => {
|
|
121
|
-
const { t } = useTranslation(meta.
|
|
121
|
+
const { t } = useTranslation(meta.profile.key);
|
|
122
122
|
|
|
123
123
|
const monolithicAction = menuActions?.length === 1 && menuActions[0];
|
|
124
124
|
const baseLabel = toLocalizedString(monolithicAction ? monolithicAction.properties!.label : props.label, t);
|
|
@@ -15,17 +15,19 @@ import { type NavTreeItemColumnsProps } from '../types';
|
|
|
15
15
|
import { NavTreeItemActionDropdownMenu, NavTreeItemMonolithicAction } from './NavTreeItemAction';
|
|
16
16
|
|
|
17
17
|
export const NavTreeItemColumns = memo(({ path, item, open }: NavTreeItemColumnsProps) => {
|
|
18
|
-
const { t } = useTranslation(meta.
|
|
18
|
+
const { t } = useTranslation(meta.profile.key);
|
|
19
19
|
const { renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
20
20
|
|
|
21
21
|
const level = path.length - 2;
|
|
22
22
|
const flattenedActions = useActions(item);
|
|
23
23
|
const allActions = useMemo(() => getListActions(flattenedActions), [flattenedActions]);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const anchored = popoverAnchorId === `${NAV_TREE_ITEM}:${item.id}`;
|
|
26
|
+
const ActionRoot = anchored ? Popover.Anchor : Fragment;
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
|
|
29
|
+
// `data-popover-anchor` lets the enclosing row highlight itself while a popover (e.g. rename) is open on it.
|
|
30
|
+
<div className='contents dx-app-no-drag' {...(anchored && { 'data-popover-anchor': '' })}>
|
|
29
31
|
<ActionRoot>
|
|
30
32
|
{allActions.length === 1 ? (
|
|
31
33
|
<Treegrid.Cell classNames='contents'>
|
|
@@ -106,7 +106,7 @@ const l0Breakpoints: Record<string, string> = {
|
|
|
106
106
|
const L0ItemRoot = memo(
|
|
107
107
|
forwardRef<HTMLButtonElement, PropsWithChildren<L0ItemRootProps>>(
|
|
108
108
|
({ item, parent, path, onMouseEnter, children }, forwardedRef) => {
|
|
109
|
-
const { t } = useTranslation(meta.
|
|
109
|
+
const { t } = useTranslation(meta.profile.key);
|
|
110
110
|
const { model } = useNavTreeContext();
|
|
111
111
|
const itemPath = useMemo(() => [...path, item.id], [item.id, path]);
|
|
112
112
|
const { id, testId } = useAtomValue(model.itemProps(itemPath));
|
|
@@ -151,7 +151,7 @@ export const L0ItemActiveTabIndicator = ({ classNames }: ThemedClassName<{}>) =>
|
|
|
151
151
|
|
|
152
152
|
// TODO(burdon): Factor out pinned (non-draggable) items.
|
|
153
153
|
const L0Item = memo(({ item, parent, path, pinned, onRearrange, onItemHover }: L0ItemProps) => {
|
|
154
|
-
const { t } = useTranslation(meta.
|
|
154
|
+
const { t } = useTranslation(meta.profile.key);
|
|
155
155
|
const itemElement = useRef<HTMLButtonElement | null>(null);
|
|
156
156
|
const [closestEdge, setEdge] = useState<Edge | null>(null);
|
|
157
157
|
const localizedString = toLocalizedString(item.properties.label, t);
|
|
@@ -238,7 +238,7 @@ const L0Item = memo(({ item, parent, path, pinned, onRearrange, onItemHover }: L
|
|
|
238
238
|
});
|
|
239
239
|
|
|
240
240
|
const ItemAvatar = ({ item }: Pick<L0ItemProps, 'item'>) => {
|
|
241
|
-
const { t } = useTranslation(meta.
|
|
241
|
+
const { t } = useTranslation(meta.profile.key);
|
|
242
242
|
|
|
243
243
|
// Actions.
|
|
244
244
|
if (item.properties.icon) {
|
|
@@ -280,7 +280,7 @@ export const L0Menu = ({
|
|
|
280
280
|
path,
|
|
281
281
|
onItemHover,
|
|
282
282
|
}: L0MenuProps) => {
|
|
283
|
-
const { t } = useTranslation(meta.
|
|
283
|
+
const { t } = useTranslation(meta.profile.key);
|
|
284
284
|
const runAction = useActionRunner();
|
|
285
285
|
const handleAction = useCallback(
|
|
286
286
|
(action: Node.Action, params: Node.InvokeProps) => {
|
|
@@ -6,7 +6,7 @@ import * as Option from 'effect/Option';
|
|
|
6
6
|
import React, { memo, useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Node } from '@dxos/app-graph';
|
|
9
|
-
import {
|
|
9
|
+
import { Paths } from '@dxos/app-toolkit';
|
|
10
10
|
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
11
11
|
import { Graph, useActionRunner, useEdges } from '@dxos/plugin-graph';
|
|
12
12
|
import { DensityProvider, IconButton, ScrollArea, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
@@ -34,7 +34,7 @@ export type L1PanelProps = {
|
|
|
34
34
|
* Space or settings panel.
|
|
35
35
|
*/
|
|
36
36
|
const L1Panel$ = ({ open, path, item, isCurrent, onBack }: L1PanelProps) => {
|
|
37
|
-
const { t } = useTranslation(meta.
|
|
37
|
+
const { t } = useTranslation(meta.profile.key);
|
|
38
38
|
const title = toLocalizedString(item.properties.label, t);
|
|
39
39
|
const isActivated = useIsActivatedWorkspace(item);
|
|
40
40
|
const shouldRenderContent = isCurrent || isActivated;
|
|
@@ -114,10 +114,10 @@ const L1PanelContent = ({ path, item, onBack }: Pick<L1PanelProps, 'open' | 'pat
|
|
|
114
114
|
* Header row.
|
|
115
115
|
*/
|
|
116
116
|
const L1PanelHeader = ({ item, path, onBack }: Pick<L1PanelProps, 'item' | 'path' | 'onBack'>) => {
|
|
117
|
-
const { t } = useTranslation(meta.
|
|
117
|
+
const { t } = useTranslation(meta.profile.key);
|
|
118
118
|
const { renderItemEnd: ItemEnd } = useNavTreeContext();
|
|
119
119
|
const title = toLocalizedString(item.properties.label, t);
|
|
120
|
-
const backCapableWorkspace = isPinnedWorkspace(item.id);
|
|
120
|
+
const backCapableWorkspace = Paths.isPinnedWorkspace(item.id);
|
|
121
121
|
|
|
122
122
|
const { menuActions, onAction } = useL1MenuActions({ item, path });
|
|
123
123
|
useLoadDescendents(item);
|
|
@@ -169,7 +169,7 @@ const MenuActions = ({
|
|
|
169
169
|
}: {
|
|
170
170
|
item: Node.Node;
|
|
171
171
|
} & Pick<L1MenuActions, 'menuActions' | 'onAction'>) => {
|
|
172
|
-
const { t } = useTranslation(meta.
|
|
172
|
+
const { t } = useTranslation(meta.profile.key);
|
|
173
173
|
|
|
174
174
|
if (menuActions.length === 0) {
|
|
175
175
|
return null;
|
|
@@ -24,7 +24,7 @@ export type CommandsDialogContentProps = {
|
|
|
24
24
|
// TODO(wittjosiah): This probably deserves its own plugin but for now it lives here w/ other navigation UI.
|
|
25
25
|
export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogContentProps>(
|
|
26
26
|
({ selected: initial }, forwardedRef) => {
|
|
27
|
-
const { t } = useTranslation(meta.
|
|
27
|
+
const { t } = useTranslation(meta.profile.key);
|
|
28
28
|
const { invokePromise } = useOperationInvoker();
|
|
29
29
|
const runAction = useActionRunner();
|
|
30
30
|
const { graph } = useAppGraph();
|
|
@@ -70,7 +70,7 @@ export const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogCo
|
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
72
|
<Dialog.Content ref={forwardedRef}>
|
|
73
|
-
<Dialog.Title srOnly>{t('commands-dialog.title', { ns: meta.
|
|
73
|
+
<Dialog.Title srOnly>{t('commands-dialog.title', { ns: meta.profile.key })}</Dialog.Title>
|
|
74
74
|
<SearchList.Root onSearch={handleSearch}>
|
|
75
75
|
<SearchList.Input placeholder={t('command-list-input.placeholder')} />
|
|
76
76
|
<SearchList.Viewport>
|
|
@@ -13,7 +13,7 @@ import { COMMANDS_DIALOG, meta } from '#meta';
|
|
|
13
13
|
// TODO(thure): Refactor to be handled by a more appropriate plugin.
|
|
14
14
|
export const CommandsTrigger = () => {
|
|
15
15
|
const { invokePromise } = useOperationInvoker();
|
|
16
|
-
const { t } = useTranslation(meta.
|
|
16
|
+
const { t } = useTranslation(meta.profile.key);
|
|
17
17
|
return (
|
|
18
18
|
<Button
|
|
19
19
|
classNames='m-1 px-1 lg:px-2'
|
|
@@ -8,7 +8,7 @@ import React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef } from
|
|
|
8
8
|
|
|
9
9
|
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
10
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
-
import { useAppGraph, useLayout } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { AppSurface, useAppGraph, useLayout } from '@dxos/app-toolkit/ui';
|
|
12
12
|
import { Graph, Node, useActionRunner } from '@dxos/plugin-graph';
|
|
13
13
|
import { useMediaQuery, useSidebars } from '@dxos/react-ui';
|
|
14
14
|
import { type TreeData, isTreeData } from '@dxos/react-ui-list';
|
|
@@ -27,7 +27,7 @@ export const NODE_TYPE = 'dxos/app-graph/node';
|
|
|
27
27
|
// TODO(wittjosiah): Avoid using Surface within the navtree, prefer declarative data flow.
|
|
28
28
|
const NavTreeItemEnd = ({ node, open }: { node: Node.Node; open: boolean }) => {
|
|
29
29
|
const data = useMemo(() => ({ id: node.id, subject: node.data, open }), [node.id, node.data, open]);
|
|
30
|
-
return <Surface.Surface
|
|
30
|
+
return <Surface.Surface type={AppSurface.NavtreeItemEnd} data={data} limit={1} />;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const getItems = (graph: Graph.ReadableGraph, node?: Node.Node, disposition?: string) => {
|
|
@@ -48,7 +48,7 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
48
48
|
const { getItem, setItem } = useNavTreeState();
|
|
49
49
|
const layout = useLayout();
|
|
50
50
|
const model = useNavTreeModel(Node.RootId);
|
|
51
|
-
const { navigationSidebarState } = useSidebars(meta.
|
|
51
|
+
const { navigationSidebarState } = useSidebars(meta.profile.key);
|
|
52
52
|
const latestRef = useRef({
|
|
53
53
|
tab,
|
|
54
54
|
activeItems: layout.active,
|
|
@@ -10,7 +10,7 @@ import { osTranslations } from '@dxos/ui-theme';
|
|
|
10
10
|
import { meta } from '#meta';
|
|
11
11
|
|
|
12
12
|
export const NavTreeDocumentTitle = ({ node }: { node?: Node.Node }) => {
|
|
13
|
-
const { t } = useTranslation(meta.
|
|
13
|
+
const { t } = useTranslation(meta.profile.key);
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
document.title = node ? toLocalizedString(node.properties.label, t) : t('current-app.name', { ns: osTranslations });
|
|
16
16
|
}, [node?.properties?.label]);
|
package/src/meta.ts
CHANGED
|
@@ -4,32 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import { Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { DXN } from '@dxos/keys';
|
|
7
|
-
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
key: DXN.make('org.dxos.plugin.navtree'),
|
|
11
|
-
name: 'Navtree',
|
|
12
|
-
author: 'DXOS',
|
|
13
|
-
spec: 'PLUGIN.mdl',
|
|
14
|
-
description: trim`
|
|
15
|
-
NavTreePlugin renders the application graph as a collapsible hierarchical tree in the Composer sidebar.
|
|
16
|
-
It manages workspace tabs at the root level and provides expand/collapse navigation for spaces, folders,
|
|
17
|
-
and objects, with open/current state persisted to localStorage across sessions.
|
|
8
|
+
import config from '../dx.config';
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
and registers graph-action keyboard shortcuts (including the ⌘K / Ctrl+K command palette) through a
|
|
21
|
-
global Keyboard singleton that tracks context as the user navigates.
|
|
22
|
-
|
|
23
|
-
An operation handler for LayoutOperation.Expose expands ancestor paths on demand so that any
|
|
24
|
-
programmatically activated item is scrolled into view in the tree.
|
|
25
|
-
|
|
26
|
-
A commands dialog surfaces all discoverable graph actions as a searchable palette, making it the primary
|
|
27
|
-
keyboard-first entry point for power users.
|
|
28
|
-
`,
|
|
29
|
-
tags: ['system'],
|
|
30
|
-
});
|
|
10
|
+
export const meta = Plugin.getMetaFromConfig(config);
|
|
31
11
|
|
|
32
12
|
// TODO(wittjosiah): Factor out.
|
|
33
13
|
export const KEY_BINDING = 'KeyBinding';
|
|
34
14
|
// TODO(wittjosiah): Factor out.
|
|
35
|
-
export const COMMANDS_DIALOG = DXN.make(`${meta.
|
|
15
|
+
export const COMMANDS_DIALOG = DXN.make(`${meta.profile.key}.commandsDialog`);
|
package/src/translations.ts
CHANGED
|
@@ -18,4 +18,4 @@ export type NavTreeStateStore = {
|
|
|
18
18
|
setItem: (path: string[], key: 'open' | 'current', next: boolean) => void;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export const State = Capability.make<NavTreeStateStore>(`${meta.
|
|
21
|
+
export const State = Capability.make<NavTreeStateStore>(`${meta.profile.key}.capability.state`);
|
|
@@ -9,4 +9,4 @@ import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
|
9
9
|
|
|
10
10
|
import { meta } from '#meta';
|
|
11
11
|
|
|
12
|
-
export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(meta.
|
|
12
|
+
export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(meta.profile.key);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/CommandsDialogContent/CommandsDialogContent.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef, useMemo, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { useAppGraph } from '@dxos/app-toolkit/ui';\nimport { Keyboard, keySymbols } from '@dxos/keyboard';\nimport { Graph, Node, useActionRunner } from '@dxos/plugin-graph';\nimport { useActions } from '@dxos/plugin-graph';\nimport { Button, Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { SearchList, useSearchListResults } from '@dxos/react-ui-search';\nimport { osTranslations } from '@dxos/ui-theme';\nimport { getHostPlatform } from '@dxos/util';\n\nimport { KEY_BINDING, meta } from '#meta';\n\nexport type CommandsDialogContentProps = {\n selected?: string;\n};\n\n// TODO(wittjosiah): This probably deserves its own plugin but for now it lives here w/ other navigation UI.\nexport const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogContentProps>(\n ({ selected: initial }, forwardedRef) => {\n const { t } = useTranslation(meta.id);\n const { invokePromise } = useOperationInvoker();\n const runAction = useActionRunner();\n const { graph } = useAppGraph();\n const [selected, setSelected] = useState<string | undefined>(initial);\n\n // Traverse graph.\n // TODO(burdon): Factor out commonality with shortcut dialog.\n const allActions = useMemo(() => {\n // TODO(burdon): Get from navtree (not keyboard).\n const current = Keyboard.singleton.getCurrentContext();\n const actionMap = new Set<string>();\n const actions: Node.ActionLike[] = [];\n Graph.traverse(graph, {\n relation: ['child', 'action'],\n visitor: (node, path) => {\n const isActionLike = Node.isAction(node) || Node.isActionGroup(node);\n const parentId = path.at(-2) ?? '';\n const matches = current === parentId || current.startsWith(parentId + '/');\n if (isActionLike && !actionMap.has(node.id) && matches) {\n actionMap.add(node.id);\n actions.push(node);\n }\n },\n });\n\n actions.sort((a, b) => {\n return toLocalizedString(a.properties.label, t)\n ?.toLowerCase()\n .localeCompare(toLocalizedString(b.properties.label, t)?.toLowerCase());\n });\n\n return actions;\n }, [graph]);\n\n const group = allActions.find(({ id }) => id === selected);\n const groupActions = useActions(graph, group?.id);\n const actions = Node.isActionGroup(group) ? groupActions : allActions;\n\n const { results, handleSearch } = useSearchListResults({\n items: actions,\n extract: (action) => toLocalizedString(action.properties.label, t),\n });\n\n return (\n <Dialog.Content ref={forwardedRef}>\n <Dialog.Title srOnly>{t('commands-dialog.title', { ns: meta.id })}</Dialog.Title>\n <SearchList.Root onSearch={handleSearch}>\n <SearchList.Input placeholder={t('command-list-input.placeholder')} />\n <SearchList.Viewport>\n {results.map((action) => {\n const shortcut =\n typeof action.properties.keyBinding === 'string'\n ? action.properties.keyBinding\n : action.properties.keyBinding?.[getHostPlatform()];\n\n return (\n <SearchList.Item\n value={action.id}\n key={action.id}\n label={toLocalizedString(action.properties.label, t)}\n icon={action.properties.icon}\n suffix={shortcut ? keySymbols(shortcut).join('') : undefined}\n onSelect={() => {\n if (action.properties.disabled) {\n return;\n }\n\n if (Node.isActionGroup(action)) {\n setSelected(action.id);\n return;\n }\n\n void invokePromise(LayoutOperation.UpdateDialog, { state: false });\n setTimeout(() => {\n const lookupId = group?.id ?? action.id;\n const node = Graph.getConnections(graph, lookupId, Node.actionRelation('inbound'))[0];\n if (node && Node.isAction(action)) {\n void runAction(action, { parent: node, caller: KEY_BINDING });\n }\n });\n }}\n classNames='flex items-center gap-2'\n disabled={action.properties.disabled}\n {...(action.properties?.testId && {\n 'data-testid': action.properties.testId,\n })}\n />\n );\n })}\n </SearchList.Viewport>\n </SearchList.Root>\n <Dialog.ActionBar>\n <Dialog.Close asChild>\n <Button classNames='w-full'>{t('close.label', { ns: osTranslations })}</Button>\n </Dialog.Close>\n </Dialog.ActionBar>\n </Dialog.Content>\n );\n },\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,OAAOA,SAASC,YAAYC,SAASC,gBAAgB;AAErD,SAASC,2BAA2B;AACpC,SAASC,uBAAuB;AAChC,SAASC,mBAAmB;AAC5B,SAASC,UAAUC,kBAAkB;AACrC,SAASC,OAAOC,MAAMC,uBAAuB;AAC7C,SAASC,kBAAkB;AAC3B,SAASC,QAAQC,QAAQC,mBAAmBC,sBAAsB;AAClE,SAASC,YAAYC,4BAA4B;AACjD,SAASC,sBAAsB;AAC/B,SAASC,uBAAuB;AAEhC,SAASC,aAAaC,YAAY;AAO3B,IAAMC,wBAAwBtB,2BACnC,CAAC,EAAEuB,UAAUC,QAAO,GAAIC,iBAAAA;AACtB,QAAM,EAAEC,EAAC,IAAKX,eAAeM,KAAKM,EAAE;AACpC,QAAM,EAAEC,cAAa,IAAKzB,oBAAAA;AAC1B,QAAM0B,YAAYnB,gBAAAA;AAClB,QAAM,EAAEoB,MAAK,IAAKzB,YAAAA;AAClB,QAAM,CAACkB,UAAUQ,WAAAA,IAAe7B,SAA6BsB,OAAAA;AAI7D,QAAMQ,aAAa/B,QAAQ,MAAA;AAEzB,UAAMgC,UAAU3B,SAAS4B,UAAUC,kBAAiB;AACpD,UAAMC,YAAY,oBAAIC,IAAAA;AACtB,UAAMC,WAA6B,CAAA;AACnC9B,UAAM+B,SAAST,OAAO;MACpBU,UAAU;QAAC;QAAS;;MACpBC,SAAS,CAACC,MAAMC,SAAAA;AACd,cAAMC,eAAenC,KAAKoC,SAASH,IAAAA,KAASjC,KAAKqC,cAAcJ,IAAAA;AAC/D,cAAMK,WAAWJ,KAAKK,GAAG,EAAC,KAAM;AAChC,cAAMC,UAAUhB,YAAYc,YAAYd,QAAQiB,WAAWH,WAAW,GAAA;AACtE,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AACH,WAAWkE,MAAI;MACdC,OAAOf,OAAOzC;MACdyD,KAAKhB,OAAOzC;MACZ+B,OAAO5C,kBAAkBsD,OAAOX,WAAWC,OAAOhC,CAAAA;MAClD2D,MAAMjB,OAAOX,WAAW4B;MACxBC,QAAQN,WAAWzE,WAAWyE,QAAAA,EAAUO,KAAK,EAAA,IAAMC;MACnDC,UAAU,MAAA;AACR,YAAIrB,OAAOX,WAAWiC,UAAU;AAC9B;QACF;AAEA,YAAIjF,KAAKqC,cAAcsB,MAAAA,GAAS;AAC9BrC,sBAAYqC,OAAOzC,EAAE;AACrB;QACF;AAEA,aAAKC,cAAcxB,gBAAgBuF,cAAc;UAAEC,OAAO;QAAM,CAAA;AAChEC,mBAAW,MAAA;AACT,gBAAMC,WAAWjC,OAAOlC,MAAMyC,OAAOzC;AACrC,gBAAMe,OAAOlC,MAAMuF,eAAejE,OAAOgE,UAAUrF,KAAKuF,eAAe,SAAA,CAAA,EAAY,CAAA;AACnF,cAAItD,QAAQjC,KAAKoC,SAASuB,MAAAA,GAAS;AACjC,iBAAKvC,UAAUuC,QAAQ;cAAE6B,QAAQvD;cAAMwD,QAAQ9E;YAAY,CAAA;UAC7D;QACF,CAAA;MACF;MACA+E,YAAW;MACXT,UAAUtB,OAAOX,WAAWiC;MAC3B,GAAItB,OAAOX,YAAY2C,UAAU;QAChC,eAAehC,OAAOX,WAAW2C;MACnC;;EAGN,CAAA,CAAA,CAAA,GAGJ,sBAAA,cAACvF,OAAOwF,WAAS,MACf,sBAAA,cAACxF,OAAOyF,OAAK;IAACC,SAAAA;KACZ,sBAAA,cAAC3F,QAAAA;IAAOuF,YAAW;KAAUzE,EAAE,eAAe;IAAE+C,IAAIvD;EAAe,CAAA,CAAA,CAAA,CAAA,CAAA;AAK7E,CAAA;",
|
|
6
|
-
"names": ["React", "forwardRef", "useMemo", "useState", "useOperationInvoker", "LayoutOperation", "useAppGraph", "Keyboard", "keySymbols", "Graph", "Node", "useActionRunner", "useActions", "Button", "Dialog", "toLocalizedString", "useTranslation", "SearchList", "useSearchListResults", "osTranslations", "getHostPlatform", "KEY_BINDING", "meta", "CommandsDialogContent", "selected", "initial", "forwardedRef", "t", "id", "invokePromise", "runAction", "graph", "setSelected", "allActions", "current", "singleton", "getCurrentContext", "actionMap", "Set", "actions", "traverse", "relation", "visitor", "node", "path", "isActionLike", "isAction", "isActionGroup", "parentId", "at", "matches", "startsWith", "has", "add", "push", "sort", "a", "b", "properties", "label", "toLowerCase", "localeCompare", "group", "find", "groupActions", "results", "handleSearch", "items", "extract", "action", "Content", "ref", "Title", "srOnly", "ns", "Root", "onSearch", "Input", "placeholder", "Viewport", "map", "shortcut", "keyBinding", "Item", "value", "key", "icon", "suffix", "join", "undefined", "onSelect", "disabled", "UpdateDialog", "state", "setTimeout", "lookupId", "getConnections", "actionRelation", "parent", "caller", "classNames", "testId", "ActionBar", "Close", "asChild"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/NavTreeContainer/NavTreeContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Instruction, extractInstruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';\nimport { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { Surface, useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { useAppGraph, useLayout } from '@dxos/app-toolkit/ui';\nimport { Graph, Node, useActionRunner } from '@dxos/plugin-graph';\nimport { useMediaQuery, useSidebars } from '@dxos/react-ui';\nimport { type TreeData, isTreeData } from '@dxos/react-ui-list';\nimport { arrayMove } from '@dxos/util';\n\nimport { NAV_TREE_ITEM, NavTree, NavTreeContext } from '#components';\nimport { useNavTreeModel, useNavTreeState } from '#hooks';\nimport { meta } from '#meta';\nimport { type NavTreeItemGraphNode } from '#types';\n\nimport { filterItems, getParent, resolveMigrationOperation } from '../../util';\n\n// TODO(thure): Is NavTree truly authoritative in this regard?\nexport const NODE_TYPE = 'dxos/app-graph/node';\n\n// TODO(wittjosiah): Avoid using Surface within the navtree, prefer declarative data flow.\nconst NavTreeItemEnd = ({ node, open }: { node: Node.Node; open: boolean }) => {\n const data = useMemo(() => ({ id: node.id, subject: node.data, open }), [node.id, node.data, open]);\n return <Surface.Surface role='navtree-item-end' data={data} limit={1} />;\n};\n\nconst getItems = (graph: Graph.ReadableGraph, node?: Node.Node, disposition?: string) => {\n return Graph.getConnections(graph, node?.id ?? Node.RootId, 'child').filter((node) => filterItems(node, disposition));\n};\n\nexport type NavTreeContainerProps = {\n popoverAnchorId?: string;\n tab: string;\n};\n\nexport const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProps>(\n ({ tab, popoverAnchorId }, forwardedRef) => {\n const [isLg] = useMediaQuery('lg');\n const { invokePromise } = useOperationInvoker();\n const runAction = useActionRunner();\n const { graph } = useAppGraph();\n const { getItem, setItem } = useNavTreeState();\n const layout = useLayout();\n const model = useNavTreeModel(Node.RootId);\n const { navigationSidebarState } = useSidebars(meta.id);\n const latestRef = useRef({\n tab,\n activeItems: layout.active,\n navigationSidebarState,\n isLg,\n });\n\n useEffect(() => {\n latestRef.current = {\n tab,\n activeItems: layout.active,\n navigationSidebarState,\n isLg,\n };\n }, [tab, layout.active, navigationSidebarState, isLg]);\n\n const handleOpenChange = useCallback(\n ({ item: { id }, path, open }: { item: Node.Node; path: string[]; open: boolean }) => {\n // TODO(thure): This might become a localstorage leak; openItemIds that no longer exist should be removed from this map.\n setItem(path, 'open', open);\n Graph.expand(graph, id, 'child');\n },\n [graph, setItem],\n );\n\n const handleTabChange = useCallback(\n (node: NavTreeItemGraphNode) => {\n Graph.expand(graph, node.id, 'child');\n\n const {\n tab: activeTab,\n activeItems,\n navigationSidebarState: currentSidebarState,\n isLg: latestIsLg,\n } = latestRef.current;\n void invokePromise(LayoutOperation.UpdateSidebar, {\n state:\n node.id === activeTab\n ? currentSidebarState === 'expanded'\n ? latestIsLg\n ? 'collapsed'\n : 'closed'\n : 'expanded'\n : 'expanded',\n });\n\n void invokePromise(LayoutOperation.SwitchWorkspace, { subject: node.id });\n\n // Open the first item if the workspace is empty.\n if (activeItems.length === 0) {\n const [item] = getItems(graph, node).filter((node) => !Node.isActionLike(node));\n if (item && item.data) {\n if (layout.mode === 'multi') {\n void invokePromise(LayoutOperation.Set, { subject: [item.id] });\n } else {\n void invokePromise(LayoutOperation.Open, { subject: [item.id] });\n }\n }\n }\n },\n [invokePromise, graph, layout.mode],\n );\n\n const blockInstruction = useCallback(\n ({ instruction, source, target }: { instruction: Instruction; source: TreeData; target: TreeData }) => {\n return target.item.properties.blockInstruction?.(source, instruction) ?? false;\n },\n [],\n );\n\n const canDrop = useCallback(({ source, target }: { source: TreeData; target: TreeData }) => {\n return target.item.properties.canDrop?.(source) ?? false;\n }, []);\n\n const canSelect = useCallback(({ item }: { item: Node.Node }) => {\n return item.properties.selectable ?? true;\n }, []);\n\n const handleSelect = useCallback(\n ({ item: node, path, option }: { item: Node.Node; path: string[]; option: boolean }) => {\n if (!node.data) {\n return;\n }\n\n if (Node.isAction(node)) {\n const [parent] = Graph.getConnections(graph, node.id, Node.childRelation('inbound'));\n if (parent) {\n void runAction(node, { parent, path, caller: NAV_TREE_ITEM });\n }\n return;\n }\n\n const current = getItem(path).current;\n if (!current) {\n if (layout.mode === 'multi') {\n void invokePromise(LayoutOperation.Set, { subject: [node.id] });\n } else {\n void invokePromise(LayoutOperation.Open, { subject: [node.id], key: node.properties.key });\n }\n } else if (option) {\n void invokePromise(LayoutOperation.Close, { subject: [node.id] });\n } else {\n void invokePromise(LayoutOperation.ScrollIntoView, { subject: node.id });\n }\n\n const defaultAction = Graph.getActions(graph, node.id).find(\n (action) => action.properties?.disposition === 'default',\n );\n if (Node.isAction(defaultAction)) {\n void runAction(defaultAction);\n }\n\n if (!isLg) {\n void invokePromise(LayoutOperation.UpdateSidebar, { state: 'closed' });\n }\n },\n [graph, invokePromise, getItem, runAction, isLg, layout.mode],\n );\n\n const handleBack = useCallback(() => void invokePromise(LayoutOperation.RevertWorkspace), [invokePromise]);\n\n // TODO(wittjosiah): Factor out hook.\n useEffect(() => {\n return monitorForElements({\n canMonitor: ({ source }) => isTreeData(source.data),\n onDrop: ({ location, source }) => {\n // Didn't drop on anything.\n if (!location.current.dropTargets.length) {\n return;\n }\n const target = location.current.dropTargets[0];\n const instruction: Instruction | null = extractInstruction(target.data);\n if (instruction !== null && instruction.type !== 'instruction-blocked') {\n const sourceNode = source.data.item as NavTreeItemGraphNode;\n const targetNode = target.data.item as NavTreeItemGraphNode;\n const sourcePath = source.data.path as string[];\n const targetPath = target.data.path as string[];\n const sameParent = sourcePath.slice(0, -1).join() === targetPath.slice(0, -1).join();\n const operation =\n sameParent && instruction.type !== 'make-child'\n ? 'rearrange'\n : resolveMigrationOperation(graph, sourceNode, targetPath, targetNode);\n const sourceParent = getParent(graph, sourceNode, sourcePath);\n const targetParent = getParent(graph, targetNode, targetPath);\n const sourceItems = getItems(graph, sourceParent);\n const targetItems = getItems(graph, targetParent);\n const sourceIndex = sourceItems.findIndex(({ id }) => id === sourceNode.id);\n const targetIndex = targetItems.findIndex(({ id }) => id === targetNode.id);\n const migrationIndex =\n instruction.type === 'make-child'\n ? undefined\n : instruction.type === 'reorder-below'\n ? targetIndex + 1\n : targetIndex;\n switch (operation) {\n case 'rearrange': {\n const nextItems = sourceItems.map(({ data }) => data);\n arrayMove(nextItems, sourceIndex, targetIndex);\n void sourceNode.properties.onRearrange?.(nextItems);\n break;\n }\n case 'copy': {\n const target = instruction.type === 'make-child' ? targetNode : targetParent;\n void target?.properties.onCopy?.(sourceNode, migrationIndex);\n break;\n }\n case 'transfer': {\n const target = instruction.type === 'make-child' ? targetNode : targetParent;\n if (!target?.properties.onTransferStart || target?.id === sourceParent?.id) {\n break;\n }\n void target?.properties.onTransferStart(sourceNode, migrationIndex);\n void sourceParent?.properties.onTransferEnd?.(sourceNode, target);\n break;\n }\n }\n }\n },\n });\n }, [graph]);\n\n const onItemHover = useCallback(({ item }: { item: Node.Node }) => Graph.expand(graph, item.id, 'child'), [graph]);\n\n const navTreeContextValue = useMemo(\n () => ({\n model,\n popoverAnchorId,\n renderItemEnd: NavTreeItemEnd,\n blockInstruction,\n canDrop,\n canSelect,\n onBack: handleBack,\n onOpenChange: handleOpenChange,\n onSelect: handleSelect,\n onTabChange: handleTabChange,\n onItemHover,\n }),\n [\n model,\n popoverAnchorId,\n blockInstruction,\n canDrop,\n canSelect,\n handleBack,\n handleOpenChange,\n handleSelect,\n handleTabChange,\n onItemHover,\n ],\n );\n\n return (\n <NavTreeContext.Provider value={navTreeContextValue}>\n <NavTree id={Node.RootId} root={Graph.getRoot(graph)} tab={tab} open={layout.sidebarOpen} ref={forwardedRef} />\n </NavTreeContext.Provider>\n );\n },\n);\n\nexport const NavTreeContainer = memo(NavTreeContainer$);\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAIA,SAA2BA,0BAA0B;AACrD,SAASC,0BAA0B;AACnC,OAAOC,SAASC,YAAYC,MAAMC,aAAaC,WAAWC,SAASC,cAAc;AAEjF,SAASC,SAASC,2BAA2B;AAC7C,SAASC,uBAAuB;AAChC,SAASC,aAAaC,iBAAiB;AACvC,SAASC,OAAOC,MAAMC,uBAAuB;AAC7C,SAASC,eAAeC,mBAAmB;AAC3C,SAAwBC,kBAAkB;AAC1C,SAASC,iBAAiB;AAE1B,SAASC,eAAeC,SAASC,sBAAsB;AACvD,SAASC,iBAAiBC,uBAAuB;AACjD,SAASC,YAAY;AAMd,IAAMC,YAAY;AAGzB,IAAMC,iBAAiB,CAAC,EAAEC,MAAMC,KAAI,MAAsC;AACxE,QAAMC,OAAOC,QAAQ,OAAO;IAAEC,IAAIJ,KAAKI;IAAIC,SAASL,KAAKE;IAAMD;EAAK,IA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AAMgC,OAAOsG;IAAaC,KAAKlH;;AAGrG,CAAA;AAGK,IAAMmH,mBAAmBC,qBAAKxH,iBAAAA;",
|
|
6
|
-
"names": ["extractInstruction", "monitorForElements", "React", "forwardRef", "memo", "useCallback", "useEffect", "useMemo", "useRef", "Surface", "useOperationInvoker", "LayoutOperation", "useAppGraph", "useLayout", "Graph", "Node", "useActionRunner", "useMediaQuery", "useSidebars", "isTreeData", "arrayMove", "NAV_TREE_ITEM", "NavTree", "NavTreeContext", "useNavTreeModel", "useNavTreeState", "meta", "NODE_TYPE", "NavTreeItemEnd", "node", "open", "data", "useMemo", "id", "subject", "Surface", "role", "limit", "getItems", "graph", "disposition", "Graph", "getConnections", "Node", "RootId", "filter", "filterItems", "NavTreeContainer$", "forwardRef", "tab", "popoverAnchorId", "forwardedRef", "isLg", "useMediaQuery", "invokePromise", "useOperationInvoker", "runAction", "useActionRunner", "useAppGraph", "getItem", "setItem", "useNavTreeState", "layout", "useLayout", "model", "useNavTreeModel", "navigationSidebarState", "useSidebars", "meta", "latestRef", "useRef", "activeItems", "active", "useEffect", "current", "handleOpenChange", "useCallback", "item", "path", "expand", "handleTabChange", "activeTab", "currentSidebarState", "latestIsLg", "LayoutOperation", "UpdateSidebar", "state", "SwitchWorkspace", "length", "isActionLike", "mode", "Set", "Open", "blockInstruction", "instruction", "source", "target", "properties", "canDrop", "canSelect", "selectable", "handleSelect", "option", "isAction", "parent", "childRelation", "caller", "NAV_TREE_ITEM", "key", "Close", "ScrollIntoView", "defaultAction", "getActions", "find", "action", "handleBack", "RevertWorkspace", "monitorForElements", "canMonitor", "isTreeData", "onDrop", "location", "dropTargets", "extractInstruction", "type", "sourceNode", "targetNode", "sourcePath", "targetPath", "sameParent", "slice", "join", "operation", "resolveMigrationOperation", "sourceParent", "getParent", "targetParent", "sourceItems", "targetItems", "sourceIndex", "findIndex", "targetIndex", "migrationIndex", "undefined", "nextItems", "map", "arrayMove", "onRearrange", "onCopy", "onTransferStart", "onTransferEnd", "onItemHover", "navTreeContextValue", "renderItemEnd", "onBack", "onOpenChange", "onSelect", "onTabChange", "NavTreeContext", "Provider", "value", "NavTree", "root", "getRoot", "sidebarOpen", "ref", "NavTreeContainer", "memo"]
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
import { Plugin } from "@dxos/app-framework";
|
|
3
|
-
import { DXN } from "@dxos/keys";
|
|
4
|
-
import { trim } from "@dxos/util";
|
|
5
|
-
var meta = Plugin.makeMeta({
|
|
6
|
-
key: DXN.make("org.dxos.plugin.navtree"),
|
|
7
|
-
name: "Navtree",
|
|
8
|
-
author: "DXOS",
|
|
9
|
-
spec: "PLUGIN.mdl",
|
|
10
|
-
description: trim`
|
|
11
|
-
NavTreePlugin renders the application graph as a collapsible hierarchical tree in the Composer sidebar.
|
|
12
|
-
It manages workspace tabs at the root level and provides expand/collapse navigation for spaces, folders,
|
|
13
|
-
and objects, with open/current state persisted to localStorage across sessions.
|
|
14
|
-
|
|
15
|
-
The plugin wires drag-and-drop rearrangement and cross-parent transfer of tree items via Pragmatic DnD,
|
|
16
|
-
and registers graph-action keyboard shortcuts (including the ⌘K / Ctrl+K command palette) through a
|
|
17
|
-
global Keyboard singleton that tracks context as the user navigates.
|
|
18
|
-
|
|
19
|
-
An operation handler for LayoutOperation.Expose expands ancestor paths on demand so that any
|
|
20
|
-
programmatically activated item is scrolled into view in the tree.
|
|
21
|
-
|
|
22
|
-
A commands dialog surfaces all discoverable graph actions as a searchable palette, making it the primary
|
|
23
|
-
keyboard-first entry point for power users.
|
|
24
|
-
`,
|
|
25
|
-
tags: [
|
|
26
|
-
"system"
|
|
27
|
-
]
|
|
28
|
-
});
|
|
29
|
-
var KEY_BINDING = "KeyBinding";
|
|
30
|
-
var COMMANDS_DIALOG = DXN.make(`${meta.id}.commandsDialog`);
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
meta,
|
|
34
|
-
KEY_BINDING,
|
|
35
|
-
COMMANDS_DIALOG
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=chunk-MDGKDQMZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\nexport const meta = Plugin.makeMeta({\n key: DXN.make('org.dxos.plugin.navtree'),\n name: 'Navtree',\n author: 'DXOS',\n spec: 'PLUGIN.mdl',\n description: trim`\n NavTreePlugin renders the application graph as a collapsible hierarchical tree in the Composer sidebar.\n It manages workspace tabs at the root level and provides expand/collapse navigation for spaces, folders,\n and objects, with open/current state persisted to localStorage across sessions.\n\n The plugin wires drag-and-drop rearrangement and cross-parent transfer of tree items via Pragmatic DnD,\n and registers graph-action keyboard shortcuts (including the ⌘K / Ctrl+K command palette) through a\n global Keyboard singleton that tracks context as the user navigates.\n\n An operation handler for LayoutOperation.Expose expands ancestor paths on demand so that any\n programmatically activated item is scrolled into view in the tree.\n\n A commands dialog surfaces all discoverable graph actions as a searchable palette, making it the primary\n keyboard-first entry point for power users.\n `,\n tags: ['system'],\n});\n\n// TODO(wittjosiah): Factor out.\nexport const KEY_BINDING = 'KeyBinding';\n// TODO(wittjosiah): Factor out.\nexport const COMMANDS_DIALOG = DXN.make(`${meta.id}.commandsDialog`);\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,YAAY;AAEd,IAAMC,OAAOH,OAAOI,SAAS;EAClCC,KAAKJ,IAAIK,KAAK,yBAAA;EACdC,MAAM;EACNC,QAAQ;EACRC,MAAM;EACNC,aAAaR;;;;;;;;;;;;;;;EAebS,MAAM;IAAC;;AACT,CAAA;AAGO,IAAMC,cAAc;AAEpB,IAAMC,kBAAkBZ,IAAIK,KAAK,GAAGH,KAAKW,EAAE,iBAAiB;",
|
|
6
|
-
"names": ["Plugin", "DXN", "trim", "meta", "makeMeta", "key", "make", "name", "author", "spec", "description", "tags", "KEY_BINDING", "COMMANDS_DIALOG", "id"]
|
|
7
|
-
}
|