@dxos/react-ui-menu 0.8.2-main.f11618f → 0.8.2-main.fbd8ed0
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/index.mjs +58 -63
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +53 -58
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +58 -63
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/ActionLabel.d.ts +8 -4
- package/dist/types/src/components/ActionLabel.d.ts.map +1 -1
- package/dist/types/src/components/DropdownMenu.d.ts +3 -2
- package/dist/types/src/components/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/MenuContext.d.ts +4 -13
- package/dist/types/src/components/MenuContext.d.ts.map +1 -1
- package/dist/types/src/{testing → components}/Menus.stories.d.ts +1 -1
- package/dist/types/src/components/Menus.stories.d.ts.map +1 -0
- package/dist/types/src/components/ToolbarMenu.d.ts +5 -1
- package/dist/types/src/components/ToolbarMenu.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useMenuActions.d.ts +12 -0
- package/dist/types/src/hooks/useMenuActions.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +26 -0
- package/dist/types/src/testing/generator.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -25
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/{defs.d.ts → types.d.ts} +3 -5
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/src/util.d.ts +2 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -12
- package/src/components/ActionLabel.tsx +11 -8
- package/src/components/DropdownMenu.tsx +5 -5
- package/src/components/MenuContext.tsx +11 -26
- package/src/{testing → components}/Menus.stories.tsx +13 -13
- package/src/components/ToolbarMenu.tsx +27 -29
- package/src/hooks/index.ts +5 -0
- package/src/{hooks.ts → hooks/useMenuActions.ts} +20 -20
- package/src/index.ts +1 -1
- package/src/testing/generator.ts +115 -0
- package/src/testing/index.ts +1 -107
- package/src/{defs.ts → types.ts} +2 -5
- package/src/util.ts +7 -7
- package/dist/types/src/defs.d.ts.map +0 -1
- package/dist/types/src/hooks.d.ts +0 -17
- package/dist/types/src/hooks.d.ts.map +0 -1
- package/dist/types/src/testing/Menus.stories.d.ts.map +0 -1
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { RegistryContext, useRxValue } from '@effect-rx/rx-react';
|
|
5
6
|
import { useSignalEffect } from '@preact/signals-react';
|
|
6
|
-
import { useCallback, useState } from 'react';
|
|
7
|
+
import { useCallback, useContext, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import { Graph, type NodeArg, type Node } from '@dxos/app-graph';
|
|
9
|
+
import { type Edge, type Edges, Graph, type NodeArg, type Node, ROOT_ID } from '@dxos/app-graph';
|
|
9
10
|
|
|
10
|
-
import { type MenuItem, type MenuItemGroup } from '
|
|
11
|
+
import { type MenuItem, type MenuItemGroup } from '../types';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const edgesArrayToRecord = (edges: { source: string; target: string }[]): Record<string, string[]> => {
|
|
13
|
+
const edgesArrayToRecord = (edges: Edge[]): Record<string, Edges> => {
|
|
15
14
|
return Object.fromEntries(
|
|
16
15
|
Object.entries(
|
|
17
16
|
edges.reduce((acc: Record<string, { inbound: string[]; outbound: string[] }>, { source, target }) => {
|
|
@@ -34,7 +33,7 @@ const edgesArrayToRecord = (edges: { source: string; target: string }[]): Record
|
|
|
34
33
|
|
|
35
34
|
return acc;
|
|
36
35
|
}, {}),
|
|
37
|
-
)
|
|
36
|
+
),
|
|
38
37
|
);
|
|
39
38
|
};
|
|
40
39
|
|
|
@@ -43,30 +42,31 @@ export type ActionGraphEdges = Edge[];
|
|
|
43
42
|
export type ActionGraphProps = { nodes: ActionGraphNodes; edges: ActionGraphEdges };
|
|
44
43
|
|
|
45
44
|
export const useMenuActions = (actionCreator: () => ActionGraphProps) => {
|
|
45
|
+
const registry = useContext(RegistryContext);
|
|
46
46
|
const initialMenuGraphProps = actionCreator();
|
|
47
47
|
|
|
48
48
|
const [graph] = useState(
|
|
49
|
-
new Graph({
|
|
49
|
+
new Graph({
|
|
50
|
+
registry,
|
|
51
|
+
nodes: initialMenuGraphProps.nodes as Node[],
|
|
52
|
+
edges: edgesArrayToRecord(initialMenuGraphProps.edges),
|
|
53
|
+
}),
|
|
50
54
|
);
|
|
51
55
|
|
|
56
|
+
// TODO(wittjosiah): Remove dependence on signals.
|
|
52
57
|
useSignalEffect(() => {
|
|
53
58
|
const menuGraphProps = actionCreator();
|
|
54
|
-
|
|
55
|
-
graph.
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
graph._addEdges(menuGraphProps.edges);
|
|
59
|
+
graph.addNodes(menuGraphProps.nodes);
|
|
60
|
+
graph.addEdges(menuGraphProps.edges);
|
|
58
61
|
});
|
|
59
62
|
|
|
60
|
-
const
|
|
61
|
-
(sourceNode
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} else {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
63
|
+
const useGroupItems = useCallback(
|
|
64
|
+
(sourceNode?: MenuItemGroup) => {
|
|
65
|
+
const items = useRxValue(graph.connections(sourceNode?.id || ROOT_ID)) as MenuItem[];
|
|
66
|
+
return items;
|
|
67
67
|
},
|
|
68
68
|
[graph],
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
return {
|
|
71
|
+
return { useGroupItems };
|
|
72
72
|
};
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
type Action,
|
|
9
|
+
Graph,
|
|
10
|
+
type NodeArg,
|
|
11
|
+
ACTION_TYPE,
|
|
12
|
+
ACTION_GROUP_TYPE,
|
|
13
|
+
actionGroupSymbol,
|
|
14
|
+
ROOT_ID,
|
|
15
|
+
} from '@dxos/app-graph';
|
|
16
|
+
import { live } from '@dxos/live-object';
|
|
17
|
+
import { faker } from '@dxos/random';
|
|
18
|
+
import { type DeepWriteable } from '@dxos/util';
|
|
19
|
+
|
|
20
|
+
import { type ActionGraphProps } from '../hooks/useMenuActions';
|
|
21
|
+
import { type MenuAction, type MenuItemGroup, type MenuItem } from '../types';
|
|
22
|
+
|
|
23
|
+
export type CreateActionsParams = Partial<{
|
|
24
|
+
type?: typeof ACTION_TYPE | typeof ACTION_GROUP_TYPE;
|
|
25
|
+
callback: () => void;
|
|
26
|
+
count: number;
|
|
27
|
+
}>;
|
|
28
|
+
|
|
29
|
+
const icons = {
|
|
30
|
+
regular: [
|
|
31
|
+
'ph--text-b--regular',
|
|
32
|
+
'ph--text-italic--regular',
|
|
33
|
+
'ph--text-h-five--regular',
|
|
34
|
+
'ph--chat-text--regular',
|
|
35
|
+
'ph--clipboard-text--regular',
|
|
36
|
+
'ph--link-simple--regular',
|
|
37
|
+
],
|
|
38
|
+
fill: [
|
|
39
|
+
'ph--text-b--fill',
|
|
40
|
+
'ph--text-italic--fill',
|
|
41
|
+
'ph--text-h-five--fill',
|
|
42
|
+
'ph--chat-text--fill',
|
|
43
|
+
'ph--clipboard-text--fill',
|
|
44
|
+
'ph--link-simple--fill',
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const createActions = (params?: CreateActionsParams) => {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
const { callback = () => console.log('invoke'), count = 12, type = ACTION_TYPE } = params ?? {};
|
|
51
|
+
return faker.helpers.multiple(
|
|
52
|
+
() =>
|
|
53
|
+
live({
|
|
54
|
+
id: faker.string.uuid(),
|
|
55
|
+
type,
|
|
56
|
+
data: type === ACTION_GROUP_TYPE ? actionGroupSymbol : callback,
|
|
57
|
+
properties: {
|
|
58
|
+
label: faker.lorem.words(2),
|
|
59
|
+
icon: faker.helpers.arrayElement(icons[faker.helpers.arrayElement(Object.keys(icons)) as keyof typeof icons]),
|
|
60
|
+
disabled: faker.helpers.arrayElement([true, false]),
|
|
61
|
+
...(type === ACTION_GROUP_TYPE && { variant: 'dropdownMenu' }),
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
{ count },
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const createNestedActions = () => {
|
|
69
|
+
const result: ActionGraphProps = { edges: [], nodes: [] };
|
|
70
|
+
const actionGroups = createActions({ type: ACTION_GROUP_TYPE });
|
|
71
|
+
actionGroups.forEach((group) => {
|
|
72
|
+
const actions = createActions();
|
|
73
|
+
result.nodes.push(group, ...actions);
|
|
74
|
+
result.edges.push(
|
|
75
|
+
{ source: 'root', target: group.id },
|
|
76
|
+
...actions.map((action) => ({ source: group.id, target: action.id })),
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const createNestedActionsResolver = (groupParams?: CreateActionsParams, params?: CreateActionsParams) => {
|
|
83
|
+
const graph = new Graph();
|
|
84
|
+
const actionGroups = createActions({ type: ACTION_GROUP_TYPE, ...groupParams });
|
|
85
|
+
actionGroups.forEach((group) => {
|
|
86
|
+
const actions = createActions(params);
|
|
87
|
+
graph.addNodes([group as NodeArg<any>, ...(actions as NodeArg<any>[])]);
|
|
88
|
+
graph.addEdges([
|
|
89
|
+
{ source: 'root', target: group.id },
|
|
90
|
+
...actions.map((action) => ({ source: group.id, target: action.id })),
|
|
91
|
+
]);
|
|
92
|
+
graph.expand(group.id);
|
|
93
|
+
});
|
|
94
|
+
const resolveGroupItems = (groupNode?: MenuItemGroup) =>
|
|
95
|
+
(graph.getActions(groupNode?.id ?? ROOT_ID) || null) as MenuItem[] | null;
|
|
96
|
+
return { resolveGroupItems };
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const mutateActionsOnInterval = (actions: Action[]) => {
|
|
100
|
+
let cursor = 0;
|
|
101
|
+
return setInterval(() => {
|
|
102
|
+
const action = actions[cursor] as DeepWriteable<Action>;
|
|
103
|
+
action.properties.icon = faker.helpers.arrayElement(
|
|
104
|
+
action.properties.icon.endsWith('regular') ? icons.fill : icons.regular,
|
|
105
|
+
);
|
|
106
|
+
action.properties.disabled = !action.properties.disabled;
|
|
107
|
+
cursor = (cursor + actions.length + 1) % actions.length;
|
|
108
|
+
}, 1_000);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const useMutateActions = (actions: MenuAction[]) =>
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const interval = mutateActionsOnInterval(actions);
|
|
114
|
+
return () => clearInterval(interval);
|
|
115
|
+
}, []);
|
package/src/testing/index.ts
CHANGED
|
@@ -2,110 +2,4 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { type Action, Graph, type NodeArg, ACTION_TYPE, ACTION_GROUP_TYPE, actionGroupSymbol } from '@dxos/app-graph';
|
|
8
|
-
import { live } from '@dxos/live-object';
|
|
9
|
-
import { faker } from '@dxos/random';
|
|
10
|
-
import { type DeepWriteable } from '@dxos/util';
|
|
11
|
-
|
|
12
|
-
import { type MenuAction, type MenuItemGroup, type MenuItem } from '../defs';
|
|
13
|
-
import { type ActionGraphProps } from '../hooks';
|
|
14
|
-
|
|
15
|
-
export type CreateActionsParams = Partial<{
|
|
16
|
-
type?: typeof ACTION_TYPE | typeof ACTION_GROUP_TYPE;
|
|
17
|
-
callback: () => void;
|
|
18
|
-
count: number;
|
|
19
|
-
}>;
|
|
20
|
-
|
|
21
|
-
const icons = {
|
|
22
|
-
regular: [
|
|
23
|
-
'ph--text-b--regular',
|
|
24
|
-
'ph--text-italic--regular',
|
|
25
|
-
'ph--text-h-five--regular',
|
|
26
|
-
'ph--chat-text--regular',
|
|
27
|
-
'ph--clipboard-text--regular',
|
|
28
|
-
'ph--link-simple--regular',
|
|
29
|
-
],
|
|
30
|
-
fill: [
|
|
31
|
-
'ph--text-b--fill',
|
|
32
|
-
'ph--text-italic--fill',
|
|
33
|
-
'ph--text-h-five--fill',
|
|
34
|
-
'ph--chat-text--fill',
|
|
35
|
-
'ph--clipboard-text--fill',
|
|
36
|
-
'ph--link-simple--fill',
|
|
37
|
-
],
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const createActions = (params?: CreateActionsParams) => {
|
|
41
|
-
// eslint-disable-next-line no-console
|
|
42
|
-
const { callback = () => console.log('invoke'), count = 12, type = ACTION_TYPE } = params ?? {};
|
|
43
|
-
return faker.helpers.multiple(
|
|
44
|
-
() =>
|
|
45
|
-
live({
|
|
46
|
-
id: faker.string.uuid(),
|
|
47
|
-
type,
|
|
48
|
-
data: type === ACTION_GROUP_TYPE ? actionGroupSymbol : callback,
|
|
49
|
-
properties: {
|
|
50
|
-
label: faker.lorem.words(2),
|
|
51
|
-
icon: faker.helpers.arrayElement(icons[faker.helpers.arrayElement(Object.keys(icons)) as keyof typeof icons]),
|
|
52
|
-
disabled: faker.helpers.arrayElement([true, false]),
|
|
53
|
-
...(type === ACTION_GROUP_TYPE && { variant: 'dropdownMenu' }),
|
|
54
|
-
},
|
|
55
|
-
}),
|
|
56
|
-
{ count },
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const createNestedActions = () => {
|
|
61
|
-
const result: ActionGraphProps = { edges: [], nodes: [] };
|
|
62
|
-
const actionGroups = createActions({ type: ACTION_GROUP_TYPE });
|
|
63
|
-
actionGroups.forEach((group) => {
|
|
64
|
-
const actions = createActions();
|
|
65
|
-
result.nodes.push(group, ...actions);
|
|
66
|
-
result.edges.push(
|
|
67
|
-
{ source: 'root', target: group.id },
|
|
68
|
-
...actions.map((action) => ({ source: group.id, target: action.id })),
|
|
69
|
-
);
|
|
70
|
-
});
|
|
71
|
-
return result;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const createNestedActionsResolver = (groupParams?: CreateActionsParams, params?: CreateActionsParams) => {
|
|
75
|
-
const graph = new Graph();
|
|
76
|
-
const actionGroups = createActions({ type: ACTION_GROUP_TYPE, ...groupParams });
|
|
77
|
-
actionGroups.forEach((group) => {
|
|
78
|
-
const actions = createActions(params);
|
|
79
|
-
// TODO(thure): these methods exist on `graph` but are marked as `@internal`; how should consumers properly build
|
|
80
|
-
// graph “islands” for the purposes of these components?
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
graph._addNodes([group as NodeArg<any>, ...(actions as NodeArg<any>[])]);
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
graph._addEdges([
|
|
85
|
-
{ source: 'root', target: group.id },
|
|
86
|
-
...actions.map((action) => ({ source: group.id, target: action.id })),
|
|
87
|
-
]);
|
|
88
|
-
void graph.expand(group);
|
|
89
|
-
});
|
|
90
|
-
const resolveGroupItems = (groupNode?: MenuItemGroup) =>
|
|
91
|
-
(graph.actions(groupNode ?? graph.root) || null) as MenuItem[] | null;
|
|
92
|
-
return { resolveGroupItems };
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export const mutateActionsOnInterval = (actions: Action[]) => {
|
|
96
|
-
let cursor = 0;
|
|
97
|
-
return setInterval(() => {
|
|
98
|
-
const action = actions[cursor] as DeepWriteable<Action>;
|
|
99
|
-
action.properties.icon = faker.helpers.arrayElement(
|
|
100
|
-
action.properties.icon.endsWith('regular') ? icons.fill : icons.regular,
|
|
101
|
-
);
|
|
102
|
-
action.properties.disabled = !action.properties.disabled;
|
|
103
|
-
cursor = (cursor + actions.length + 1) % actions.length;
|
|
104
|
-
}, 1_000);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export const useMutateActions = (actions: MenuAction[]) =>
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
const interval = mutateActionsOnInterval(actions);
|
|
110
|
-
return () => clearInterval(interval);
|
|
111
|
-
}, []);
|
|
5
|
+
export * from './generator';
|
package/src/{defs.ts → types.ts}
RENAMED
|
@@ -26,8 +26,6 @@ export type MenuItemGroupProperties = {
|
|
|
26
26
|
|
|
27
27
|
export type MenuAction<P extends {} = {}> = Action<P & MenuActionProperties>;
|
|
28
28
|
|
|
29
|
-
export type MenuActionHandler<A extends Node = MenuAction> = (action: A) => void;
|
|
30
|
-
|
|
31
29
|
export const MenuSeparatorType = '@dxos/react-ui-toolbar/separator' as const;
|
|
32
30
|
|
|
33
31
|
export type MenuSeparator = Node<never, Pick<ToolbarSeparatorProps, 'variant'>> & {
|
|
@@ -47,9 +45,8 @@ export type MenuItem = MenuSeparator | MenuAction | MenuItemGroup;
|
|
|
47
45
|
|
|
48
46
|
export type MenuItemsResolver = (group?: MenuItemGroup) => MenuItem[] | null;
|
|
49
47
|
|
|
50
|
-
export type MenuContextValue
|
|
51
|
-
|
|
48
|
+
export type MenuContextValue = {
|
|
49
|
+
useGroupItems: MenuItemsResolver;
|
|
52
50
|
iconSize: IconButtonProps['size'];
|
|
53
|
-
onAction: MenuActionHandler<A>;
|
|
54
51
|
attendableId?: string;
|
|
55
52
|
};
|
package/src/util.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type MenuItemGroup,
|
|
12
12
|
type MenuItemGroupProperties,
|
|
13
13
|
type MenuSeparator,
|
|
14
|
-
} from './
|
|
14
|
+
} from './types';
|
|
15
15
|
|
|
16
16
|
export const getShortcut = (action: ActionLike) => {
|
|
17
17
|
return typeof action.properties?.keyBinding === 'string'
|
|
@@ -21,16 +21,16 @@ export const getShortcut = (action: ActionLike) => {
|
|
|
21
21
|
|
|
22
22
|
export const fallbackIcon = 'ph--placeholder--regular';
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
export const createMenuAction = <P extends {} = {}>(
|
|
25
|
+
id: string,
|
|
26
|
+
invoke: () => void,
|
|
27
|
+
properties: P & MenuActionProperties,
|
|
28
|
+
) =>
|
|
29
29
|
({
|
|
30
30
|
id,
|
|
31
31
|
type: ACTION_TYPE,
|
|
32
32
|
properties,
|
|
33
|
-
data:
|
|
33
|
+
data: invoke,
|
|
34
34
|
}) satisfies MenuAction;
|
|
35
35
|
|
|
36
36
|
export const createMenuItemGroup = <
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../src/defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEnH,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,MAAM,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC;AAE7E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,IAAI,GAAG,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAEjF,eAAO,MAAM,iBAAiB,EAAG,kCAA2C,CAAC;AAE7E,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,GAAG;IAChF,IAAI,EAAE,OAAO,iBAAiB,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,IAAI,KAAG,IAAI,IAAI,aAAgD,CAAC;AAElG,MAAM,MAAM,2BAA2B,GAAG;IAAE,iBAAiB,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AACzF,MAAM,MAAM,6BAA6B,GAAG;IAAE,iBAAiB,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE/F,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;AAEhG,eAAO,MAAM,WAAW,SAAU,IAAI,KAAG,IAAI,IAAI,aAAgD,CAAC;AAElG,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,UAAU,GAAG,aAAa,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,CAAC,EAAE,aAAa,KAAK,QAAQ,EAAE,GAAG,IAAI,CAAC;AAE7E,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,IAAI,GAAG,UAAU,IAAI;IAC1D,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type NodeArg } from '@dxos/app-graph';
|
|
2
|
-
import { type MenuItem, type MenuItemGroup } from './defs';
|
|
3
|
-
type Edge = {
|
|
4
|
-
source: string;
|
|
5
|
-
target: string;
|
|
6
|
-
};
|
|
7
|
-
export type ActionGraphNodes = NodeArg<any>[];
|
|
8
|
-
export type ActionGraphEdges = Edge[];
|
|
9
|
-
export type ActionGraphProps = {
|
|
10
|
-
nodes: ActionGraphNodes;
|
|
11
|
-
edges: ActionGraphEdges;
|
|
12
|
-
};
|
|
13
|
-
export declare const useMenuActions: (actionCreator: () => ActionGraphProps) => {
|
|
14
|
-
resolveGroupItems: (sourceNode?: MenuItemGroup) => MenuItem[] | null;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAOA,OAAO,EAAS,KAAK,OAAO,EAAa,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE3D,KAAK,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA6B/C,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,EAAE,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEpF,eAAO,MAAM,cAAc,kBAAmB,MAAM,gBAAgB;qCAgBnD,aAAa;CAW7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Menus.stories.d.ts","sourceRoot":"","sources":["../../../../src/testing/Menus.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AACrB,OAAO,KAAsB,MAAM,OAAO,CAAC;;;;;;;;;;;;;AAc3C,wBAKE;AAOF,eAAO,MAAM,YAAY;;CAcxB,CAAC;AAEF,eAAO,MAAM,OAAO;;CAQnB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CASjC,CAAC"}
|