@dxos/plugin-navtree 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe
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/{app-graph-builder-6JDBQ25U.mjs → app-graph-builder-OHSCN3GX.mjs} +11 -10
- package/dist/lib/browser/app-graph-builder-OHSCN3GX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WCARAZ7J.mjs → chunk-5VLWX4PK.mjs} +4 -4
- package/dist/lib/browser/chunk-5VLWX4PK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZKVY35IG.mjs → chunk-7D2MPHXV.mjs} +125 -111
- package/dist/lib/browser/chunk-7D2MPHXV.mjs.map +7 -0
- package/dist/lib/browser/chunk-E6MZBCU5.mjs +19 -0
- package/dist/lib/browser/chunk-E6MZBCU5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -7
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-N35ZIHFD.mjs → intent-resolver-YUVXVPHG.mjs} +6 -6
- package/dist/lib/browser/intent-resolver-YUVXVPHG.mjs.map +7 -0
- package/dist/lib/browser/{keyboard-HMTMA33N.mjs → keyboard-YYTYJW4M.mjs} +4 -4
- package/dist/lib/browser/{keyboard-HMTMA33N.mjs.map → keyboard-YYTYJW4M.mjs.map} +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-5PZ4XJT7.mjs → react-surface-J7MWWAGD.mjs} +10 -10
- package/dist/lib/browser/react-surface-J7MWWAGD.mjs.map +7 -0
- package/dist/lib/browser/{state-P5DGL7KS.mjs → state-EUSVT6BI.mjs} +7 -7
- package/dist/lib/browser/state-EUSVT6BI.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts +1 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +12 -9
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +1 -2
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -2
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +2 -0
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +1 -2
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.d.ts +1 -2
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +2 -3
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +1 -1
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -48
- package/src/NavTreePlugin.tsx +70 -71
- package/src/capabilities/app-graph-builder.ts +8 -7
- package/src/capabilities/capabilities.ts +2 -2
- package/src/capabilities/intent-resolver.ts +1 -1
- package/src/capabilities/react-surface.tsx +4 -4
- package/src/capabilities/state.ts +2 -2
- package/src/components/CommandsDialog/CommandsDialog.tsx +14 -6
- package/src/components/CommandsDialog/CommandsTrigger.tsx +4 -3
- package/src/components/NavTree/NavTree.stories.tsx +63 -49
- package/src/components/NavTree/NavTree.tsx +4 -0
- package/src/components/NavTreeContainer.tsx +51 -21
- package/src/components/NavTreeDocumentTitle.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +2 -4
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +5 -4
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +27 -21
- package/src/components/Sidebar/L0Menu.tsx +54 -53
- package/src/components/Sidebar/L1Panel.tsx +7 -10
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +3 -4
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
- package/src/events.ts +2 -2
- package/src/experimental/Tree.stories.tsx +26 -30
- package/src/experimental/Tree.tsx +6 -23
- package/src/meta.ts +10 -7
- package/src/testing/app-graph-builder.ts +19 -18
- package/src/testing/generator.ts +2 -2
- package/src/types.ts +4 -3
- package/dist/lib/browser/app-graph-builder-6JDBQ25U.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERDGQTH5.mjs +0 -16
- package/dist/lib/browser/chunk-ERDGQTH5.mjs.map +0 -7
- package/dist/lib/browser/chunk-WCARAZ7J.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZKVY35IG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-N35ZIHFD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5PZ4XJT7.mjs.map +0 -7
- package/dist/lib/browser/state-P5DGL7KS.mjs.map +0 -7
|
@@ -7,6 +7,8 @@ import React from 'react';
|
|
|
7
7
|
import { Avatar, type AvatarStatus, type Size } from '@dxos/react-ui';
|
|
8
8
|
import { hexToFallback } from '@dxos/util';
|
|
9
9
|
|
|
10
|
+
import { L0ItemActiveTabIndicator } from '../Sidebar';
|
|
11
|
+
|
|
10
12
|
export type UserAccountAvatarProps = {
|
|
11
13
|
size?: Size;
|
|
12
14
|
userId?: string;
|
|
@@ -19,17 +21,23 @@ export const UserAccountAvatar = ({ size, userId, hue, emoji, status }: UserAcco
|
|
|
19
21
|
const fallbackValue = hexToFallback(userId ?? '0');
|
|
20
22
|
|
|
21
23
|
return (
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
<>
|
|
25
|
+
<L0ItemActiveTabIndicator classNames='inset-block-6' />
|
|
26
|
+
<div
|
|
27
|
+
className='grid place-items-center dx-focus-ring-group-indicator rounded-full'
|
|
28
|
+
data-joyride='welcome/account'
|
|
29
|
+
>
|
|
30
|
+
<Avatar.Root>
|
|
31
|
+
<Avatar.Content
|
|
32
|
+
variant='circle'
|
|
33
|
+
size={size ?? 12}
|
|
34
|
+
status={status ?? 'active'}
|
|
35
|
+
hue={hue || fallbackValue.hue}
|
|
36
|
+
fallback={emoji || fallbackValue.emoji}
|
|
37
|
+
data-testid='treeView.userAccount'
|
|
38
|
+
/>
|
|
39
|
+
</Avatar.Root>
|
|
40
|
+
</div>
|
|
41
|
+
</>
|
|
34
42
|
);
|
|
35
43
|
};
|
package/src/events.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { Events } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { meta } from './meta';
|
|
8
8
|
|
|
9
9
|
export namespace NavTreeEvents {
|
|
10
|
-
export const StateReady = Events.createStateEvent(
|
|
10
|
+
export const StateReady = Events.createStateEvent(meta.id);
|
|
11
11
|
}
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta } from '@storybook/react-vite';
|
|
8
6
|
import React, { type JSX, type PropsWithChildren, useEffect, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { faker } from '@dxos/random';
|
|
11
9
|
import { Icon, IconButton } from '@dxos/react-ui';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
14
12
|
|
|
15
13
|
import { type ItemMap, Tree, type TreeNodeData, type TreeProps, visitNodes, visitor } from './Tree';
|
|
16
14
|
|
|
@@ -32,7 +30,7 @@ const Container = ({ children, sidebar }: PropsWithChildren<{ sidebar: JSX.Eleme
|
|
|
32
30
|
<div className='flex'>
|
|
33
31
|
{/* TODO(burdon): Custom thin scrollbar. */}
|
|
34
32
|
{/* TODO(burdon): Horizontal scrolling within navtree? */}
|
|
35
|
-
<div className='flex flex-col overflow-y-auto
|
|
33
|
+
<div className='flex flex-col overflow-y-auto is-[300px] bg-neutral-100 dark:bg-neutral-950'>{sidebar}</div>
|
|
36
34
|
<div className='flex flex-col grow overflow-hidden'>{children}</div>
|
|
37
35
|
</div>
|
|
38
36
|
);
|
|
@@ -105,27 +103,6 @@ const data: TreeNodeData[] = [
|
|
|
105
103
|
},
|
|
106
104
|
];
|
|
107
105
|
|
|
108
|
-
export const Default = () => {
|
|
109
|
-
return <Container sidebar={<Sidebar mutate />} />;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const Visitor = () => {
|
|
113
|
-
const [items] = useState(data);
|
|
114
|
-
const root = items[0];
|
|
115
|
-
const [openItems] = useState<ItemMap>({ [root.children![0].id]: true });
|
|
116
|
-
return (
|
|
117
|
-
<div className='flex flex-col'>
|
|
118
|
-
{Array.from(visitor(root, openItems)).map(({ node: { id, title }, depth }) => (
|
|
119
|
-
<div key={id} className='grid grid-cols-[40px_400px_400px] font-mono'>
|
|
120
|
-
<div>{depth}</div>
|
|
121
|
-
<div>{id}</div>
|
|
122
|
-
<div>{title}</div>
|
|
123
|
-
</div>
|
|
124
|
-
))}
|
|
125
|
-
</div>
|
|
126
|
-
);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
106
|
const Sidebar = ({ mutate }: { mutate?: boolean }) => {
|
|
130
107
|
const [items, setItems] = useState(data);
|
|
131
108
|
const root = items[0];
|
|
@@ -212,7 +189,7 @@ const Sidebar = ({ mutate }: { mutate?: boolean }) => {
|
|
|
212
189
|
/>
|
|
213
190
|
</div>
|
|
214
191
|
|
|
215
|
-
<div className='flex items-center my-2
|
|
192
|
+
<div className='flex items-center my-2 pli-2 gap-2'>
|
|
216
193
|
<IconButton icon='ph--plus-circle--regular' iconOnly label='Create space' onClick={handleCreateSpace} />
|
|
217
194
|
<span className='grow text-sm' onClick={handleCreateSpace}>
|
|
218
195
|
New space
|
|
@@ -226,9 +203,28 @@ const Sidebar = ({ mutate }: { mutate?: boolean }) => {
|
|
|
226
203
|
const meta = {
|
|
227
204
|
title: 'plugins/plugin-navtree/experimental/Tree',
|
|
228
205
|
component: Tree,
|
|
229
|
-
decorators: [withTheme, withLayout({
|
|
206
|
+
decorators: [withTheme, withLayout({ container: 'column' })],
|
|
230
207
|
} satisfies Meta<typeof Tree>;
|
|
231
208
|
|
|
232
209
|
export default meta;
|
|
233
210
|
|
|
234
|
-
|
|
211
|
+
export const Default = () => {
|
|
212
|
+
return <Container sidebar={<Sidebar mutate />} />;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const Visitor = () => {
|
|
216
|
+
const [items] = useState(data);
|
|
217
|
+
const root = items[0];
|
|
218
|
+
const [openItems] = useState<ItemMap>({ [root.children![0].id]: true });
|
|
219
|
+
return (
|
|
220
|
+
<div className='flex flex-col'>
|
|
221
|
+
{Array.from(visitor(root, openItems)).map(({ node: { id, title }, depth }) => (
|
|
222
|
+
<div key={id} className='grid grid-cols-[40px_400px_400px] font-mono'>
|
|
223
|
+
<div>{depth}</div>
|
|
224
|
+
<div>{id}</div>
|
|
225
|
+
<div>{title}</div>
|
|
226
|
+
</div>
|
|
227
|
+
))}
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
230
|
+
};
|
|
@@ -7,27 +7,19 @@ import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
|
|
|
7
7
|
import { type ClassNameValue, Icon, type Size } from '@dxos/react-ui';
|
|
8
8
|
import { mx } from '@dxos/react-ui-theme';
|
|
9
9
|
|
|
10
|
-
// TODO(burdon): Rounded border if first/last.
|
|
11
|
-
const styles = {
|
|
12
|
-
hover: 'hover:bg-slate-400 dark:hover:bg-slate-800',
|
|
13
|
-
selected: '!bg-slate-300 dark:!bg-slate-700',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
10
|
export const IconButton = ({
|
|
17
11
|
iconName,
|
|
18
12
|
classNames,
|
|
19
13
|
size = 4,
|
|
20
14
|
onClick,
|
|
21
|
-
weight = 'regular',
|
|
22
15
|
}: {
|
|
23
16
|
iconName: string;
|
|
24
17
|
classNames?: ClassNameValue;
|
|
25
18
|
size?: Size;
|
|
26
|
-
weight?: 'regular' | 'duotone' | 'fill';
|
|
27
19
|
} & Pick<HTMLAttributes<HTMLDivElement>, 'onClick'>) => {
|
|
28
20
|
// TODO(burdon): Density aware.
|
|
29
21
|
return (
|
|
30
|
-
<div className={mx('flex
|
|
22
|
+
<div className={mx('flex is-6 bs-6 items-center justify-center select-none', classNames)} onClick={onClick}>
|
|
31
23
|
<Icon icon={iconName} classNames='cursor-pointer' size={size} />
|
|
32
24
|
</div>
|
|
33
25
|
);
|
|
@@ -124,7 +116,6 @@ const StateIcon = ({ node, open, selected, active }: TreeNodeProps) => {
|
|
|
124
116
|
<IconButton
|
|
125
117
|
iconName={isActive ? 'ph--user-circle--regular' : 'ph--circle--regular'}
|
|
126
118
|
size={4}
|
|
127
|
-
weight={selected?.[id] ? 'fill' : 'duotone'}
|
|
128
119
|
classNames={mx(
|
|
129
120
|
'text-slate-500',
|
|
130
121
|
!isChildActive && 'opacity-0 transition duration-500',
|
|
@@ -158,15 +149,7 @@ const OpenIcon = ({
|
|
|
158
149
|
const ItemIcon = ({
|
|
159
150
|
node: { children, iconName = children?.length ? 'ph--folder--regular' : 'ph--file--regular', color },
|
|
160
151
|
}: Pick<TreeNodeProps, 'node'>) => {
|
|
161
|
-
return (
|
|
162
|
-
(iconName && (
|
|
163
|
-
<IconButton
|
|
164
|
-
iconName={iconName}
|
|
165
|
-
classNames={color ?? 'text-neutral-700 dark:text-neutral-300'}
|
|
166
|
-
weight={color ? 'duotone' : 'regular'}
|
|
167
|
-
/>
|
|
168
|
-
)) || <div />
|
|
169
|
-
);
|
|
152
|
+
return (iconName && <IconButton iconName={iconName} classNames={color ?? 'text-subdued'} />) || <div />;
|
|
170
153
|
};
|
|
171
154
|
|
|
172
155
|
const MenuItem = ({ node: { id }, onMenuAction }: Pick<TreeNodeProps, 'node' | 'onMenuAction'>) => {
|
|
@@ -210,9 +193,9 @@ export const TreeNodeRow = (props: TreeNodeProps & { className?: string }) => {
|
|
|
210
193
|
<Grid
|
|
211
194
|
style={{ paddingLeft: `${(depth - 1) * 24}px` }}
|
|
212
195
|
className={mx(
|
|
213
|
-
'group
|
|
214
|
-
|
|
215
|
-
selected?.[id] &&
|
|
196
|
+
'group is-full items-center cursor-pointer bg-hoverSurface',
|
|
197
|
+
// TODO(burdon): Use data-active.
|
|
198
|
+
selected?.[id] && 'bg-activeSurface',
|
|
216
199
|
className,
|
|
217
200
|
)}
|
|
218
201
|
onClick={() => selected && onChangeSelected?.(id, !selected[id])}
|
|
@@ -255,7 +238,7 @@ export const TreeChildNodes = ({
|
|
|
255
238
|
} = props;
|
|
256
239
|
return (
|
|
257
240
|
<div className={mx('flex flex-col mt-0.5 gap-0.5', className)}>
|
|
258
|
-
{children?.map((child
|
|
241
|
+
{children?.map((child) => (
|
|
259
242
|
<TreeNode key={child.id} {...props} depth={depth + 1} node={child} ancestors={[...ancestors, props.node]} />
|
|
260
243
|
))}
|
|
261
244
|
</div>
|
package/src/meta.ts
CHANGED
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
+
export const meta: PluginMeta = {
|
|
9
|
+
id: 'dxos.org/plugin/navtree',
|
|
10
|
+
name: 'Navtree',
|
|
11
|
+
description: trim`
|
|
12
|
+
Hierarchical navigation tree for browsing spaces, folders, and objects.
|
|
13
|
+
Provides sidebar navigation with collapsible sections and quick access to workspace content.
|
|
14
|
+
`,
|
|
15
|
+
};
|
|
8
16
|
|
|
9
17
|
// TODO(wittjosiah): Factor out.
|
|
10
18
|
export const KEY_BINDING = 'KeyBinding';
|
|
11
19
|
// TODO(wittjosiah): Factor out.
|
|
12
|
-
export const COMMANDS_DIALOG = `${
|
|
13
|
-
|
|
14
|
-
export const meta: PluginMeta = {
|
|
15
|
-
id: NAVTREE_PLUGIN,
|
|
16
|
-
name: 'Navtree',
|
|
17
|
-
};
|
|
20
|
+
export const COMMANDS_DIALOG = `${meta.id}/CommandsDialog`;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
7
8
|
|
|
8
9
|
import { type PluginContext } from '@dxos/app-framework';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
@@ -27,8 +28,8 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
27
28
|
createExtension({
|
|
28
29
|
id: 'app-menu',
|
|
29
30
|
actions: (node) =>
|
|
30
|
-
|
|
31
|
-
pipe(
|
|
31
|
+
Atom.make((get) =>
|
|
32
|
+
Function.pipe(
|
|
32
33
|
get(node),
|
|
33
34
|
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
34
35
|
Option.map((node) => {
|
|
@@ -54,8 +55,8 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
54
55
|
createExtension({
|
|
55
56
|
id: 'user-account',
|
|
56
57
|
connector: (node) =>
|
|
57
|
-
|
|
58
|
-
pipe(
|
|
58
|
+
Atom.make((get) =>
|
|
59
|
+
Function.pipe(
|
|
59
60
|
get(node),
|
|
60
61
|
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
61
62
|
Option.map(() => {
|
|
@@ -111,8 +112,8 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
111
112
|
id: 'spaces-root',
|
|
112
113
|
position: 'hoist',
|
|
113
114
|
connector: (node) =>
|
|
114
|
-
|
|
115
|
-
pipe(
|
|
115
|
+
Atom.make((get) =>
|
|
116
|
+
Function.pipe(
|
|
116
117
|
get(node),
|
|
117
118
|
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
118
119
|
Option.map(() => {
|
|
@@ -137,7 +138,7 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
137
138
|
createExtension({
|
|
138
139
|
id: 'spaces',
|
|
139
140
|
connector: (node) => {
|
|
140
|
-
const count =
|
|
141
|
+
const count = Atom.make((get) => {
|
|
141
142
|
let value = 3;
|
|
142
143
|
const interval = setInterval(() => {
|
|
143
144
|
if (value >= 10) {
|
|
@@ -152,8 +153,8 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
152
153
|
return value;
|
|
153
154
|
});
|
|
154
155
|
|
|
155
|
-
return
|
|
156
|
-
pipe(
|
|
156
|
+
return Atom.make((get) =>
|
|
157
|
+
Function.pipe(
|
|
157
158
|
get(node),
|
|
158
159
|
Option.flatMap((node) => (node.id === 'spaces-root' ? Option.some(node) : Option.none())),
|
|
159
160
|
Option.map(() => {
|
|
@@ -178,8 +179,8 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
178
179
|
createExtension({
|
|
179
180
|
id: 'space-actions',
|
|
180
181
|
actions: (node) =>
|
|
181
|
-
|
|
182
|
-
pipe(
|
|
182
|
+
Atom.make((get) =>
|
|
183
|
+
Function.pipe(
|
|
183
184
|
get(node),
|
|
184
185
|
Option.flatMap((node) => (node.type === 'space' ? Option.some(node) : Option.none())),
|
|
185
186
|
Option.map((node) => {
|
|
@@ -204,7 +205,7 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
204
205
|
createExtension({
|
|
205
206
|
id: 'objects',
|
|
206
207
|
connector: (node) => {
|
|
207
|
-
const count =
|
|
208
|
+
const count = Atom.make((get) => {
|
|
208
209
|
let value = 3;
|
|
209
210
|
const interval = setInterval(() => {
|
|
210
211
|
if (value >= 20) {
|
|
@@ -219,8 +220,8 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
219
220
|
return value;
|
|
220
221
|
});
|
|
221
222
|
|
|
222
|
-
return
|
|
223
|
-
pipe(
|
|
223
|
+
return Atom.make((get) =>
|
|
224
|
+
Function.pipe(
|
|
224
225
|
get(node),
|
|
225
226
|
Option.flatMap((node) => (node.type === 'space' ? Option.some(node) : Option.none())),
|
|
226
227
|
Option.map((node) => {
|
|
@@ -244,8 +245,8 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
244
245
|
createExtension({
|
|
245
246
|
id: 'object-actions',
|
|
246
247
|
actions: (node) =>
|
|
247
|
-
|
|
248
|
-
pipe(
|
|
248
|
+
Atom.make((get) =>
|
|
249
|
+
Function.pipe(
|
|
249
250
|
get(node),
|
|
250
251
|
Option.flatMap((node) => (node.type === 'object' ? Option.some(node) : Option.none())),
|
|
251
252
|
Option.map((node) => {
|
package/src/testing/generator.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { type NodeArg } from '@dxos/app-graph';
|
|
8
8
|
import { type Live, Obj, Type } from '@dxos/echo';
|
|
9
|
-
import { TypedObject } from '@dxos/echo
|
|
9
|
+
import { TypedObject } from '@dxos/echo/internal';
|
|
10
10
|
import { faker } from '@dxos/random';
|
|
11
11
|
import { range } from '@dxos/util';
|
|
12
12
|
|
package/src/types.ts
CHANGED
|
@@ -28,13 +28,14 @@ export type FlattenedActions = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
type SharedProperties = {
|
|
31
|
-
|
|
32
|
-
icon?: string;
|
|
31
|
+
testId?: string;
|
|
33
32
|
disabled?: boolean;
|
|
34
33
|
position?: Position;
|
|
35
|
-
|
|
34
|
+
label: Label;
|
|
36
35
|
className?: string;
|
|
37
36
|
headingClassName?: string;
|
|
37
|
+
icon?: string;
|
|
38
|
+
iconHue?: string;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
export type NodeProperties = SharedProperties & {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { ROOT_ID, createExtension } from '@dxos/plugin-graph';\n\nimport { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: NAVTREE_PLUGIN,\n actions: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: COMMANDS_DIALOG,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: COMMANDS_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n );\n },\n properties: {\n label: ['open commands label', { ns: NAVTREE_PLUGIN }],\n icon: 'ph--magnifying-glass--regular',\n keyBinding: {\n macos: 'meta+k',\n windows: 'ctrl+k',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,UAAU;AACnB,SAASC,QAAQC,YAAY;AAE7B,SAASC,cAAcC,cAAkCC,aAAaC,oBAAoB;AAC1F,SAASC,SAASC,uBAAuB;AAIzC,IAAA,4BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC;EACJC,SAAS,CAACC,SACRC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UAAUA,MAAKH,OAAOU,UAAUF,OAAOG,KAAKR,KAAAA,IAAQK,OAAOI,KAAI,CAAA,GAC/EJ,OAAOK,IAAI,MAAM;IACf;MACEb,IAAIc;MACJC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKtB,QAAQuB,cAAcrB,aAAasB,gBAAgB;AACzF,cAAMF,SACJG,aAAaC,aAAaC,cAAc;UACtCC,MAAM;UACNC,SAASV;UACTW,SAAS;YACPC,YAAY;UACd;QACF,CAAA,CAAA;MAEJ;MACAC,YAAY;QACVC,OAAO;UAAC;UAAuB;YAAEC,IAAI5B;UAAe;;QACpD6B,MAAM;QACNC,YAAY;UACVC,OAAO;UACPC,SAAS;QACX;MACF;IACF;GACD,GACDzB,OAAO0B,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;AAGjC,CAAA,CAAA;",
|
|
6
|
-
"names": ["Rx", "Option", "pipe", "Capabilities", "LayoutAction", "contributes", "createIntent", "ROOT_ID", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "NAVTREE_PLUGIN", "actions", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "ROOT_ID", "some", "none", "map", "COMMANDS_DIALOG", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "createIntent", "LayoutAction", "UpdateDialog", "part", "subject", "options", "blockAlign", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "getOrElse"]
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
var NAVTREE_PLUGIN = "dxos.org/plugin/navtree";
|
|
3
|
-
var KEY_BINDING = "KeyBinding";
|
|
4
|
-
var COMMANDS_DIALOG = `${NAVTREE_PLUGIN}/CommandsDialog`;
|
|
5
|
-
var meta = {
|
|
6
|
-
id: NAVTREE_PLUGIN,
|
|
7
|
-
name: "Navtree"
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
NAVTREE_PLUGIN,
|
|
12
|
-
KEY_BINDING,
|
|
13
|
-
COMMANDS_DIALOG,
|
|
14
|
-
meta
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-ERDGQTH5.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 { type PluginMeta } from '@dxos/app-framework';\n\nexport const NAVTREE_PLUGIN = 'dxos.org/plugin/navtree';\n\n// TODO(wittjosiah): Factor out.\nexport const KEY_BINDING = 'KeyBinding';\n// TODO(wittjosiah): Factor out.\nexport const COMMANDS_DIALOG = `${NAVTREE_PLUGIN}/CommandsDialog`;\n\nexport const meta: PluginMeta = {\n id: NAVTREE_PLUGIN,\n name: 'Navtree',\n};\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,iBAAiB;AAGvB,IAAMC,cAAc;AAEpB,IAAMC,kBAAkB,GAAGF,cAAAA;AAE3B,IAAMG,OAAmB;EAC9BC,IAAIJ;EACJK,MAAM;AACR;",
|
|
6
|
-
"names": ["NAVTREE_PLUGIN", "KEY_BINDING", "COMMANDS_DIALOG", "meta", "id", "name"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type Live } from '@dxos/live-object';\n\nimport { NAVTREE_PLUGIN } from '../meta';\nimport { type NavTreeItemGraphNode } from '../types';\n\nexport namespace NavTreeCapabilities {\n export const State = defineCapability<{\n state: Map<string, Live<{ open: boolean; current: boolean; alternateTree?: boolean }>>;\n getItem: (path: string[]) => Live<{ open: boolean; current: boolean; alternateTree?: boolean }>;\n setItem: (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => void;\n isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;\n isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;\n isAlternateTree: (path: string[], item: NavTreeItemGraphNode) => boolean;\n }>(`${NAVTREE_PLUGIN}/capability/state`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,wBAAwB;UAMhBC,sBAAAA;uBACFC,QAAQC,iBAOlB,GAAGC,cAAAA,mBAAiC;AACzC,GATiBH,wBAAAA,sBAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["defineCapability", "NavTreeCapabilities", "State", "defineCapability", "NAVTREE_PLUGIN"]
|
|
7
|
-
}
|