@dxos/plugin-navtree 0.9.1-main.c7dcc2e112 → 0.9.1-staging.ee54ba693a
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/{NavTreeContainer-QIWROTCL.mjs → NavTreeContainer-ICDKC2GI.mjs} +2 -2
- package/dist/lib/neutral/capabilities/index.mjs +2 -2
- package/dist/lib/neutral/{chunk-UBVNITFG.mjs → chunk-4RN6TH36.mjs} +20 -1
- package/dist/lib/neutral/chunk-4RN6TH36.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +8 -6
- package/dist/lib/neutral/components/index.mjs.map +3 -3
- package/dist/lib/neutral/containers/index.mjs +2 -2
- package/dist/lib/neutral/hooks/index.mjs +7 -4
- package/dist/lib/neutral/hooks/index.mjs.map +3 -3
- package/dist/lib/neutral/{keyboard-EJ65BVTC.mjs → keyboard-JM2HCF5N.mjs} +5 -3
- package/dist/lib/neutral/{keyboard-EJ65BVTC.mjs.map → keyboard-JM2HCF5N.mjs.map} +3 -3
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/{react-surface-N4EESW3L.mjs → react-surface-QPMUEDZX.mjs} +3 -2
- package/dist/lib/neutral/react-surface-QPMUEDZX.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +2 -2
- package/dist/lib/neutral/testing/index.mjs.map +3 -3
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +1 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +4 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +1 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -41
- package/src/capabilities/keyboard.ts +5 -2
- package/src/capabilities/react-surface.tsx +2 -1
- package/src/components/NavTree/NavTree.stories.tsx +43 -36
- package/src/components/NavTree/NavTree.tsx +3 -3
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +2 -1
- package/src/components/Sidebar/L0Menu.tsx +10 -3
- package/src/containers/NavTreeContainer/NavTreeContainer.tsx +14 -0
- package/src/hooks/useNavTreeModel.ts +8 -4
- package/src/testing/generator.ts +8 -6
- package/src/types/schema.ts +2 -2
- package/dist/lib/neutral/chunk-UBVNITFG.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-N4EESW3L.mjs.map +0 -7
- /package/dist/lib/neutral/{NavTreeContainer-QIWROTCL.mjs.map → NavTreeContainer-ICDKC2GI.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-navtree",
|
|
3
|
-
"version": "0.9.1-
|
|
3
|
+
"version": "0.9.1-staging.ee54ba693a",
|
|
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",
|
|
@@ -98,54 +98,53 @@
|
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@atlaskit/pragmatic-drag-and-drop": "1.7.7",
|
|
100
100
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
|
|
101
|
-
"@dxos/app-framework": "0.9.1-
|
|
102
|
-
"@dxos/app-
|
|
103
|
-
"@dxos/
|
|
104
|
-
"@dxos/
|
|
105
|
-
"@dxos/
|
|
106
|
-
"@dxos/
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/
|
|
109
|
-
"@dxos/
|
|
110
|
-
"@dxos/
|
|
111
|
-
"@dxos/
|
|
112
|
-
"@dxos/
|
|
113
|
-
"@dxos/
|
|
114
|
-
"@dxos/
|
|
115
|
-
"@dxos/react-ui-list": "0.9.1-
|
|
116
|
-
"@dxos/react-ui-
|
|
117
|
-
"@dxos/react-ui-
|
|
118
|
-
"@dxos/react-ui-
|
|
119
|
-
"@dxos/
|
|
120
|
-
"@dxos/
|
|
121
|
-
"@dxos/keyboard": "0.9.1-main.c7dcc2e112"
|
|
101
|
+
"@dxos/app-framework": "0.9.1-staging.ee54ba693a",
|
|
102
|
+
"@dxos/app-graph": "0.9.1-staging.ee54ba693a",
|
|
103
|
+
"@dxos/compute": "0.9.1-staging.ee54ba693a",
|
|
104
|
+
"@dxos/debug": "0.9.1-staging.ee54ba693a",
|
|
105
|
+
"@dxos/app-toolkit": "0.9.1-staging.ee54ba693a",
|
|
106
|
+
"@dxos/async": "0.9.1-staging.ee54ba693a",
|
|
107
|
+
"@dxos/echo": "0.9.1-staging.ee54ba693a",
|
|
108
|
+
"@dxos/keyboard": "0.9.1-staging.ee54ba693a",
|
|
109
|
+
"@dxos/keys": "0.9.1-staging.ee54ba693a",
|
|
110
|
+
"@dxos/lit-ui": "0.9.1-staging.ee54ba693a",
|
|
111
|
+
"@dxos/log": "0.9.1-staging.ee54ba693a",
|
|
112
|
+
"@dxos/plugin-deck": "0.9.1-staging.ee54ba693a",
|
|
113
|
+
"@dxos/plugin-graph": "0.9.1-staging.ee54ba693a",
|
|
114
|
+
"@dxos/random": "0.9.1-staging.ee54ba693a",
|
|
115
|
+
"@dxos/react-ui-list": "0.9.1-staging.ee54ba693a",
|
|
116
|
+
"@dxos/react-ui-attention": "0.9.1-staging.ee54ba693a",
|
|
117
|
+
"@dxos/react-ui-menu": "0.9.1-staging.ee54ba693a",
|
|
118
|
+
"@dxos/react-ui-search": "0.9.1-staging.ee54ba693a",
|
|
119
|
+
"@dxos/react-ui-tabs": "0.9.1-staging.ee54ba693a",
|
|
120
|
+
"@dxos/util": "0.9.1-staging.ee54ba693a"
|
|
122
121
|
},
|
|
123
122
|
"devDependencies": {
|
|
124
123
|
"@effect-atom/atom-react": "^0.5.0",
|
|
125
|
-
"@effect/platform": "0.96.
|
|
126
|
-
"@types/react": "~19.2.
|
|
124
|
+
"@effect/platform": "0.96.2",
|
|
125
|
+
"@types/react": "~19.2.17",
|
|
127
126
|
"@types/react-dom": "~19.2.3",
|
|
128
|
-
"effect": "3.21.
|
|
129
|
-
"react": "~19.2.
|
|
130
|
-
"react-dom": "~19.2.
|
|
127
|
+
"effect": "3.21.4",
|
|
128
|
+
"react": "~19.2.7",
|
|
129
|
+
"react-dom": "~19.2.7",
|
|
131
130
|
"vite": "^8.0.16",
|
|
132
|
-
"@dxos/plugin-
|
|
133
|
-
"@dxos/plugin-
|
|
134
|
-
"@dxos/plugin-
|
|
135
|
-
"@dxos/
|
|
136
|
-
"@dxos/
|
|
137
|
-
"@dxos/
|
|
138
|
-
"@dxos/
|
|
139
|
-
"@dxos/
|
|
131
|
+
"@dxos/plugin-attention": "0.9.1-staging.ee54ba693a",
|
|
132
|
+
"@dxos/plugin-client": "0.9.1-staging.ee54ba693a",
|
|
133
|
+
"@dxos/plugin-space": "0.9.1-staging.ee54ba693a",
|
|
134
|
+
"@dxos/storybook-utils": "0.9.1-staging.ee54ba693a",
|
|
135
|
+
"@dxos/react-ui": "0.9.1-staging.ee54ba693a",
|
|
136
|
+
"@dxos/ui-theme": "0.9.1-staging.ee54ba693a",
|
|
137
|
+
"@dxos/plugin-theme": "0.9.1-staging.ee54ba693a",
|
|
138
|
+
"@dxos/plugin-testing": "0.9.1-staging.ee54ba693a"
|
|
140
139
|
},
|
|
141
140
|
"peerDependencies": {
|
|
142
141
|
"@effect-atom/atom-react": "^0.5.0",
|
|
143
|
-
"@effect/platform": "0.96.
|
|
144
|
-
"effect": "3.21.
|
|
145
|
-
"react": "~19.2.
|
|
146
|
-
"react-dom": "~19.2.
|
|
147
|
-
"@dxos/ui-theme": "0.9.1-
|
|
148
|
-
"@dxos/react-ui": "0.9.1-
|
|
142
|
+
"@effect/platform": "0.96.2",
|
|
143
|
+
"effect": "3.21.4",
|
|
144
|
+
"react": "~19.2.7",
|
|
145
|
+
"react-dom": "~19.2.7",
|
|
146
|
+
"@dxos/ui-theme": "0.9.1-staging.ee54ba693a",
|
|
147
|
+
"@dxos/react-ui": "0.9.1-staging.ee54ba693a"
|
|
149
148
|
},
|
|
150
149
|
"publishConfig": {
|
|
151
150
|
"access": "public"
|
|
@@ -46,11 +46,14 @@ export default Capability.makeModule(
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const
|
|
49
|
+
const syncBindings = () => {
|
|
50
50
|
Graph.traverse(graph, { relation: ['child', 'action'], visitor });
|
|
51
|
-
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const eventHandler = debounce(syncBindings, 500);
|
|
52
54
|
|
|
53
55
|
const unsubscribe = graph.onNodeChanged.on(eventHandler);
|
|
56
|
+
syncBindings();
|
|
54
57
|
|
|
55
58
|
// TODO(burdon): Create context and plugin.
|
|
56
59
|
Keyboard.singleton.initialize();
|
|
@@ -9,6 +9,7 @@ import { Capabilities, Capability } from '@dxos/app-framework';
|
|
|
9
9
|
import { Surface } from '@dxos/app-framework/ui';
|
|
10
10
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
11
11
|
import { Node } from '@dxos/plugin-graph';
|
|
12
|
+
import { Position } from '@dxos/util';
|
|
12
13
|
|
|
13
14
|
import { CommandsDialogContent, CommandsTrigger, NavTreeContainer, NavTreeDocumentTitle } from '#containers';
|
|
14
15
|
import { COMMANDS_DIALOG } from '#meta';
|
|
@@ -38,7 +39,7 @@ export default Capability.makeModule(() =>
|
|
|
38
39
|
Surface.create({
|
|
39
40
|
id: 'searchInput',
|
|
40
41
|
filter: Surface.makeFilter(AppSurface.SearchInput),
|
|
41
|
-
position:
|
|
42
|
+
position: Position.last,
|
|
42
43
|
component: () => <CommandsTrigger />,
|
|
43
44
|
}),
|
|
44
45
|
]),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Atom, type Registry } from '@effect-atom/atom-react';
|
|
6
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
7
|
import * as Effect from 'effect/Effect';
|
|
8
|
-
import React, {
|
|
8
|
+
import React, { useEffect, useRef } from 'react';
|
|
9
9
|
import { expect, userEvent, within } from 'storybook/test';
|
|
10
10
|
|
|
11
11
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
@@ -15,9 +15,8 @@ import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
|
15
15
|
import { Operation, OperationHandlerSet } from '@dxos/compute';
|
|
16
16
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
17
17
|
import { random } from '@dxos/random';
|
|
18
|
-
import { IconButton, Input, Main, Toolbar } from '@dxos/react-ui';
|
|
18
|
+
import { Focus, IconButton, Input, Main, Panel, Toolbar } from '@dxos/react-ui';
|
|
19
19
|
import { useAttention, useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
20
|
-
import { Stack, StackItem } from '@dxos/react-ui-stack';
|
|
21
20
|
import { withLayout } from '@dxos/react-ui/testing';
|
|
22
21
|
import { mx } from '@dxos/ui-theme';
|
|
23
22
|
|
|
@@ -35,9 +34,8 @@ const container = 'flex flex-col grow gap-2 p-4 rounded-md';
|
|
|
35
34
|
|
|
36
35
|
const StoryPlankHeading = ({ attendableId }: { attendableId: string }) => {
|
|
37
36
|
const { hasAttention } = useAttention(attendableId);
|
|
38
|
-
console.log('hasAttention', hasAttention);
|
|
39
37
|
return (
|
|
40
|
-
<
|
|
38
|
+
<Panel.Toolbar classNames='border-b border-separator'>
|
|
41
39
|
<IconButton
|
|
42
40
|
density='lg'
|
|
43
41
|
icon='ph--circle--regular'
|
|
@@ -46,8 +44,7 @@ const StoryPlankHeading = ({ attendableId }: { attendableId: string }) => {
|
|
|
46
44
|
variant={hasAttention ? 'primary' : 'ghost'}
|
|
47
45
|
classNames='w-(--dx-rail-action) h-(--dx-rail-action)'
|
|
48
46
|
/>
|
|
49
|
-
|
|
50
|
-
</div>
|
|
47
|
+
</Panel.Toolbar>
|
|
51
48
|
);
|
|
52
49
|
};
|
|
53
50
|
|
|
@@ -57,40 +54,50 @@ const StoryPlank = ({ attendableId }: { attendableId: string }) => {
|
|
|
57
54
|
|
|
58
55
|
// NOTE(thure): This is the same workaround as in Plank, but that component is out of scope for this story.
|
|
59
56
|
// TODO(thure): Tabster’s focus group should handle moving focus to Main, but something is blocking it.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
// Attached imperatively because `Focus.Item`/`Panel.Root` expose a narrow (slottable) prop surface.
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const element = rootElement.current;
|
|
60
|
+
if (!element) {
|
|
61
|
+
return;
|
|
63
62
|
}
|
|
63
|
+
|
|
64
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
65
|
+
if (event.target === element && event.key === 'Escape') {
|
|
66
|
+
element.closest('main')?.focus();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
element.addEventListener('keydown', handleKeyDown);
|
|
71
|
+
return () => element.removeEventListener('keydown', handleKeyDown);
|
|
64
72
|
}, []);
|
|
65
73
|
|
|
66
74
|
return (
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<div className={mx(container, 'm-2 bg-current-surface')}>
|
|
82
|
-
<Input.Root>
|
|
83
|
-
<Input.Label>Level 1 (group)</Input.Label>
|
|
84
|
-
</Input.Root>
|
|
85
|
-
<div className={mx(container, 'bg-base-surface')}>
|
|
75
|
+
<Focus.Item asChild ref={rootElement}>
|
|
76
|
+
<Panel.Root
|
|
77
|
+
{...attentionAttrs}
|
|
78
|
+
role='article'
|
|
79
|
+
classNames='is-[30rem] shrink-0 bs-full bg-base-surface border-e border-separator'
|
|
80
|
+
>
|
|
81
|
+
<StoryPlankHeading attendableId={attendableId} />
|
|
82
|
+
<Panel.Content classNames='grid'>
|
|
83
|
+
<Toolbar.Root classNames='border-b border-subdued-separator'>
|
|
84
|
+
<Toolbar.Button>Test</Toolbar.Button>
|
|
85
|
+
</Toolbar.Root>
|
|
86
|
+
|
|
87
|
+
<div className={mx(container, 'm-2 bg-current-surface')}>
|
|
86
88
|
<Input.Root>
|
|
87
|
-
<Input.Label>Level
|
|
88
|
-
<Input.TextArea placeholder='Enter text' />
|
|
89
|
+
<Input.Label>Level 1 (group)</Input.Label>
|
|
89
90
|
</Input.Root>
|
|
91
|
+
<div className={mx(container, 'bg-base-surface')}>
|
|
92
|
+
<Input.Root>
|
|
93
|
+
<Input.Label>Level 2 (base)</Input.Label>
|
|
94
|
+
<Input.TextArea placeholder='Enter text' />
|
|
95
|
+
</Input.Root>
|
|
96
|
+
</div>
|
|
90
97
|
</div>
|
|
91
|
-
</
|
|
92
|
-
</
|
|
93
|
-
</
|
|
98
|
+
</Panel.Content>
|
|
99
|
+
</Panel.Root>
|
|
100
|
+
</Focus.Item>
|
|
94
101
|
);
|
|
95
102
|
};
|
|
96
103
|
|
|
@@ -103,10 +110,10 @@ const DefaultStory = () => {
|
|
|
103
110
|
<NavTreeContainer tab={state.tab} />
|
|
104
111
|
</Main.NavigationSidebar>
|
|
105
112
|
<Main.Content bounce handlesFocus>
|
|
106
|
-
<
|
|
113
|
+
<div role='none' className='flex grow overflow-x-auto'>
|
|
107
114
|
<StoryPlank attendableId='space-0:object-0' />
|
|
108
115
|
<StoryPlank attendableId='space-0:object-1' />
|
|
109
|
-
</
|
|
116
|
+
</div>
|
|
110
117
|
</Main.Content>
|
|
111
118
|
</Main.Root>
|
|
112
119
|
);
|
|
@@ -8,7 +8,7 @@ import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
|
8
8
|
import { Node, useConnections, useActions as useGraphActions } from '@dxos/plugin-graph';
|
|
9
9
|
import { type MenuItem } from '@dxos/react-ui-menu';
|
|
10
10
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
11
|
-
import {
|
|
11
|
+
import { Position } from '@dxos/util';
|
|
12
12
|
|
|
13
13
|
import { useLoadDescendents } from '#hooks';
|
|
14
14
|
|
|
@@ -76,11 +76,11 @@ const useTopLevelNavItems = (root?: Node.Node) => {
|
|
|
76
76
|
|
|
77
77
|
const topLevelActions = rootActions
|
|
78
78
|
.filter((action) => action.properties.disposition === 'menu')
|
|
79
|
-
.toSorted((a, b) =>
|
|
79
|
+
.toSorted((a, b) => Position.compare(a.properties, b.properties));
|
|
80
80
|
const pinnedItems = [
|
|
81
81
|
...outboundPinnedItems,
|
|
82
82
|
...rootActions.filter((action) => action.properties.disposition === 'pin-end'),
|
|
83
|
-
].toSorted((a, b) =>
|
|
83
|
+
].toSorted((a, b) => Position.compare(a.properties, b.properties));
|
|
84
84
|
|
|
85
85
|
return {
|
|
86
86
|
pinnedItems,
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { Fragment, memo, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Popover,
|
|
7
|
+
import { Popover, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Treegrid } from '@dxos/react-ui-list';
|
|
8
9
|
|
|
9
10
|
import { getListActions, useActions } from '#hooks';
|
|
10
11
|
import { meta } from '#meta';
|
|
@@ -30,7 +30,6 @@ import { useActionRunner } from '@dxos/plugin-graph';
|
|
|
30
30
|
import {
|
|
31
31
|
Icon,
|
|
32
32
|
IconButton,
|
|
33
|
-
ListItem,
|
|
34
33
|
ScrollArea,
|
|
35
34
|
type ThemedClassName,
|
|
36
35
|
Tooltip,
|
|
@@ -38,8 +37,8 @@ import {
|
|
|
38
37
|
useMediaQuery,
|
|
39
38
|
useTranslation,
|
|
40
39
|
} from '@dxos/react-ui';
|
|
40
|
+
import { DropIndicator } from '@dxos/react-ui-list';
|
|
41
41
|
import { Menu, type MenuItem } from '@dxos/react-ui-menu';
|
|
42
|
-
import type { StackItemRearrangeHandler } from '@dxos/react-ui-stack';
|
|
43
42
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
44
43
|
import { mx } from '@dxos/ui-theme';
|
|
45
44
|
import { arrayMove } from '@dxos/util';
|
|
@@ -60,6 +59,14 @@ type L0ItemData = {
|
|
|
60
59
|
type: 'l0Item';
|
|
61
60
|
};
|
|
62
61
|
|
|
62
|
+
// Local rearrange-handler callback shape; drag-and-drop is wired directly via pragmatic-dnd in `L0Item`,
|
|
63
|
+
// so only the callback signature is needed here.
|
|
64
|
+
type StackItemRearrangeHandler<Data extends { id: string } = { id: string }> = (
|
|
65
|
+
source: Data,
|
|
66
|
+
target: Data,
|
|
67
|
+
closestEdge: Edge | null,
|
|
68
|
+
) => void;
|
|
69
|
+
|
|
63
70
|
type L0ItemRootProps = {
|
|
64
71
|
item: Node.Node;
|
|
65
72
|
parent?: Node.Node;
|
|
@@ -232,7 +239,7 @@ const L0Item = memo(({ item, parent, path, pinned, onRearrange, onItemHover }: L
|
|
|
232
239
|
<span id={`${item.id}__label`} className='sr-only'>
|
|
233
240
|
{localizedString}
|
|
234
241
|
</span>
|
|
235
|
-
{closestEdge && <
|
|
242
|
+
{closestEdge && <DropIndicator edge={closestEdge} />}
|
|
236
243
|
</L0ItemRoot>
|
|
237
244
|
);
|
|
238
245
|
});
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Instruction, extractInstruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
|
|
6
6
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
7
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
7
8
|
import React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
8
9
|
|
|
9
10
|
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
@@ -230,6 +231,19 @@ export const NavTreeContainer$ = forwardRef<HTMLDivElement, NavTreeContainerProp
|
|
|
230
231
|
});
|
|
231
232
|
}, [graph]);
|
|
232
233
|
|
|
234
|
+
// Group nodes are always expanded and have no toggle, so they never trigger Graph.expand through
|
|
235
|
+
// user interaction. Watch the workspace's children reactively and mark any group nodes as open
|
|
236
|
+
// so the state machinery treats them consistently with regular open nodes (including on next load).
|
|
237
|
+
const workspaceChildren = useAtomValue(graph.connections(tab, 'child'));
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
for (const child of workspaceChildren) {
|
|
240
|
+
if (child.properties.disposition === 'group') {
|
|
241
|
+
setItem([Node.RootId, tab, child.id], 'open', true);
|
|
242
|
+
Graph.expand(graph, child.id, 'child');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, [workspaceChildren, tab, setItem, graph]);
|
|
246
|
+
|
|
233
247
|
const onItemHover = useCallback(({ item }: { item: Node.Node }) => Graph.expand(graph, item.id, 'child'), [graph]);
|
|
234
248
|
|
|
235
249
|
const navTreeContextValue = useMemo(
|
|
@@ -45,12 +45,16 @@ const createItemPropsFamily = (graph: ReturnType<typeof useAppGraph>['graph']) =
|
|
|
45
45
|
const droppable =
|
|
46
46
|
node.properties.droppable === false || parentNode?.properties.childrenDroppable === false ? false : undefined;
|
|
47
47
|
|
|
48
|
+
const disposition = node.properties.disposition as string | undefined;
|
|
49
|
+
const isGroup = disposition === 'group';
|
|
50
|
+
|
|
48
51
|
return {
|
|
49
52
|
id: node.id,
|
|
50
|
-
parentOf,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
parentOf: isGroup ? undefined : parentOf,
|
|
54
|
+
disposition,
|
|
55
|
+
disabled: isGroup || node.properties.disabled,
|
|
56
|
+
draggable: isGroup ? false : node.properties.draggable,
|
|
57
|
+
droppable: isGroup ? false : droppable,
|
|
54
58
|
label: node.properties.label ?? node.id,
|
|
55
59
|
className: mx(node.properties.className, node.properties.modified && 'italic'),
|
|
56
60
|
headingClassName: node.properties.headingClassName,
|
package/src/testing/generator.ts
CHANGED
|
@@ -58,12 +58,14 @@ export const defaultGenerators: { [type: string]: ObjectDataGenerator } = {
|
|
|
58
58
|
|
|
59
59
|
project: {
|
|
60
60
|
createSchema: () =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
Type.makeObject(DXN.make('com.example.type.project', '0.1.0'))(
|
|
62
|
+
Schema.Struct({
|
|
63
|
+
title: Schema.String,
|
|
64
|
+
repo: Schema.String,
|
|
65
|
+
status: Schema.String,
|
|
66
|
+
priority: Schema.Number,
|
|
67
|
+
}),
|
|
68
|
+
),
|
|
67
69
|
|
|
68
70
|
createData: () => ({
|
|
69
71
|
title: random.commerce.productName(),
|
package/src/types/schema.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type FlattenedActions = {
|
|
|
30
30
|
type SharedProperties = {
|
|
31
31
|
testId?: string;
|
|
32
32
|
disabled?: boolean;
|
|
33
|
-
position?: Position;
|
|
33
|
+
position?: Position.Position;
|
|
34
34
|
label: Label;
|
|
35
35
|
className?: string;
|
|
36
36
|
headingClassName?: string;
|
|
@@ -62,7 +62,7 @@ export type ActionProperties = SharedProperties & {
|
|
|
62
62
|
*/
|
|
63
63
|
export type KeyBinding = {
|
|
64
64
|
// NOTE: Keys come from `getHostPlatform` in `@dxos/util`.
|
|
65
|
-
// TODO(thure): Dedupe
|
|
65
|
+
// TODO(thure): Dedupe with the other platform key-binding definitions.
|
|
66
66
|
windows?: string;
|
|
67
67
|
macos?: string;
|
|
68
68
|
ios?: string;
|
|
@@ -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 { AppSurface, 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 type={AppSurface.NavtreeItemEnd} 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.profile.key);\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,YAAYC,aAAaC,iBAAiB;AACnD,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,IAAI;IAACD,KAAKI;IAAIJ,KAAKE;IAAMD;GAAK;AAClG,SAAO,sBAAA,cAACK,QAAQA,SAAO;IAACC,MAAMC,WAAWC;IAAgBP;IAAYQ,OAAO;;AAC9E;AAEA,IAAMC,WAAW,CAACC,OAA4BZ,MAAkBa,gBAAAA;AAC9D,SAAOC,MAAMC,eAAeH,OAAOZ,MAAMI,MAAMY,KAAKC,QAAQ,OAAA,EAASC,OAAO,CAAClB,UAASmB,YAAYnB,OAAMa,WAAAA,CAAAA;AAC1G;AAOO,IAAMO,oBAAoBC,2BAC/B,CAAC,EAAEC,KAAKC,gBAAe,GAAIC,iBAAAA;AACzB,QAAM,CAACC,IAAAA,IAAQC,cAAc,IAAA;AAC7B,QAAM,EAAEC,cAAa,IAAKC,oBAAAA;AAC1B,QAAMC,YAAYC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C,WAAWkD,mBAAmBnD,SAAQnE,OAAOuG,cAAcvG,IAAI;AAC1E;cACF;AACA,mBAAKmE,SAAQC,WAAWkD,gBAAgBxB,YAAYiB,cAAAA;AACpD,mBAAKR,cAAcnC,WAAWmD,gBAAgBzB,YAAY3B,OAAAA;AAC1D;YACF;UACF;QACF;MACF;IACF,CAAA;EACF,GAAG;IAAC3D;GAAM;AAEV,QAAMgH,cAAczE,YAAY,CAAC,EAAEC,KAAI,MAA4BtC,MAAMwC,OAAO1C,OAAOwC,KAAKhD,IAAI,OAAA,GAAU;IAACQ;GAAM;AAEjH,QAAMiH,sBAAsB1H,QAC1B,OAAO;IACLkC;IACAd;IACAuG,eAAe/H;IACfqE;IACAK;IACAC;IACAqD,QAAQtC;IACRuC,cAAc9E;IACd+E,UAAUrD;IACVsD,aAAa3E;IACbqE;EACF,IACA;IACEvF;IACAd;IACA6C;IACAK;IACAC;IACAe;IACAvC;IACA0B;IACArB;IACAqE;GACD;AAGH,SACE,sBAAA,cAACO,eAAeC,UAAQ;IAACC,OAAOR;KAC9B,sBAAA,cAACS,SAAAA;IAAQlI,IAAIY,KAAKC;IAAQsH,MAAMzH,MAAM0H,QAAQ5H,KAAAA;IAAQU;IAAUrB,MAAMkC,OAAOsG;IAAaC,KAAKlH;;AAGrG,CAAA;AAGK,IAAMmH,mBAAmBC,qBAAKxH,iBAAAA;",
|
|
6
|
-
"names": ["extractInstruction", "monitorForElements", "React", "forwardRef", "memo", "useCallback", "useEffect", "useMemo", "useRef", "Surface", "useOperationInvoker", "LayoutOperation", "AppSurface", "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", "type", "AppSurface", "NavtreeItemEnd", "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", "profile", "key", "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", "Close", "ScrollIntoView", "defaultAction", "getActions", "find", "action", "handleBack", "RevertWorkspace", "monitorForElements", "canMonitor", "isTreeData", "onDrop", "location", "dropTargets", "extractInstruction", "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,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React, { type ComponentProps } from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Node } from '@dxos/plugin-graph';\n\nimport { CommandsDialogContent, CommandsTrigger, NavTreeContainer, NavTreeDocumentTitle } from '#containers';\nimport { COMMANDS_DIALOG } from '#meta';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: COMMANDS_DIALOG,\n filter: AppSurface.component<ComponentProps<typeof CommandsDialogContent>>(AppSurface.Dialog, COMMANDS_DIALOG),\n component: ({ data, ref }) => <CommandsDialogContent {...data.props} ref={ref} />,\n }),\n Surface.create({\n id: 'navigation',\n filter: Surface.makeFilter(AppSurface.Navigation),\n component: ({ data, ref }) => (\n <NavTreeContainer tab={data.current} popoverAnchorId={data.popoverAnchorId} ref={ref} />\n ),\n }),\n Surface.create({\n id: 'documentTitle',\n filter: Surface.makeFilter(AppSurface.DocumentTitle),\n component: ({ data }) => (\n <NavTreeDocumentTitle node={Node.isGraphNode(data.subject) ? data.subject : undefined} />\n ),\n }),\n Surface.create({\n id: 'searchInput',\n filter: Surface.makeFilter(AppSurface.SearchInput),\n position: 'last',\n component: () => <CommandsTrigger />,\n }),\n ]),\n ),\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAoC;AAE3C,SAASC,cAAcC,kBAAkB;AACzC,SAASC,eAAe;AACxB,SAASC,kBAAkB;AAC3B,SAASC,YAAY;AAErB,SAASC,uBAAuBC,iBAAiBC,kBAAkBC,4BAA4B;AAC/F,SAASC,uBAAuB;AAEhC,IAAA,wBAAeR,WAAWS,WAAW,MAC5BC,eACLV,WAAWW,YAAYZ,aAAaa,cAAc;EAChDX,QAAQY,OAAO;IACbC,IAAIN;IACJO,QAAQb,WAAWc,UAAwDd,WAAWe,QAAQT,eAAAA;IAC9FQ,WAAW,CAAC,EAAEE,MAAMC,IAAG,MAAO,sBAAA,cAACf,uBAAAA;MAAuB,GAAGc,KAAKE;MAAOD;;EACvE,CAAA;EACAlB,QAAQY,OAAO;IACbC,IAAI;IACJC,QAAQd,QAAQoB,WAAWnB,WAAWoB,UAAU;IAChDN,WAAW,CAAC,EAAEE,MAAMC,IAAG,MACrB,sBAAA,cAACb,kBAAAA;MAAiBiB,KAAKL,KAAKM;MAASC,iBAAiBP,KAAKO;MAAiBN;;EAEhF,CAAA;EACAlB,QAAQY,OAAO;IACbC,IAAI;IACJC,QAAQd,QAAQoB,WAAWnB,WAAWwB,aAAa;IACnDV,WAAW,CAAC,EAAEE,KAAI,MAChB,sBAAA,cAACX,sBAAAA;MAAqBoB,MAAMxB,KAAKyB,YAAYV,KAAKW,OAAO,IAAIX,KAAKW,UAAUC;;EAEhF,CAAA;EACA7B,QAAQY,OAAO;IACbC,IAAI;IACJC,QAAQd,QAAQoB,WAAWnB,WAAW6B,WAAW;IACjDC,UAAU;IACVhB,WAAW,MAAM,sBAAA,cAACX,iBAAAA,IAAAA;EACpB,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "Capabilities", "Capability", "Surface", "AppSurface", "Node", "CommandsDialogContent", "CommandsTrigger", "NavTreeContainer", "NavTreeDocumentTitle", "COMMANDS_DIALOG", "makeModule", "succeed", "contributes", "ReactSurface", "create", "id", "filter", "component", "Dialog", "data", "ref", "props", "makeFilter", "Navigation", "tab", "current", "popoverAnchorId", "DocumentTitle", "node", "isGraphNode", "subject", "undefined", "SearchInput", "position"]
|
|
7
|
-
}
|
/package/dist/lib/neutral/{NavTreeContainer-QIWROTCL.mjs.map → NavTreeContainer-ICDKC2GI.mjs.map}
RENAMED
|
File without changes
|