@dxos/react-ui-menu 0.8.4-main.ead640a → 0.8.4-main.f466a3d56e
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +542 -420
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +14 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +542 -420
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +16 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/builder.d.ts +27 -2
- package/dist/types/src/builder.d.ts.map +1 -1
- package/dist/types/src/builder.test.d.ts +2 -0
- package/dist/types/src/builder.test.d.ts.map +1 -0
- package/dist/types/src/components/ActionLabel.d.ts +3 -3
- package/dist/types/src/components/ActionLabel.d.ts.map +1 -1
- package/dist/types/src/components/DropdownMenu.d.ts +4 -2
- package/dist/types/src/components/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu.d.ts +50 -0
- package/dist/types/src/components/Menu.d.ts.map +1 -0
- package/dist/types/src/components/Menu.stories.d.ts +21 -0
- package/dist/types/src/components/Menu.stories.d.ts.map +1 -0
- package/dist/types/src/components/Menu.test.d.ts +2 -0
- package/dist/types/src/components/Menu.test.d.ts.map +1 -0
- package/dist/types/src/components/ToolbarMenu.d.ts +7 -6
- package/dist/types/src/components/ToolbarMenu.d.ts.map +1 -1
- package/dist/types/src/components/ToolbarMenu.stories.d.ts +16 -2
- package/dist/types/src/components/ToolbarMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useMenuActions.d.ts +15 -7
- package/dist/types/src/hooks/useMenuActions.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +20 -14
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +38 -27
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +14 -5
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -33
- package/src/builder.test.ts +224 -0
- package/src/builder.ts +69 -19
- package/src/components/ActionLabel.tsx +7 -6
- package/src/components/DropdownMenu.tsx +12 -6
- package/src/components/Menu.stories.tsx +266 -0
- package/src/components/Menu.test.tsx +447 -0
- package/src/components/Menu.tsx +348 -0
- package/src/components/ToolbarMenu.stories.tsx +50 -28
- package/src/components/ToolbarMenu.tsx +148 -90
- package/src/components/index.ts +1 -3
- package/src/hooks/useMenuActions.ts +39 -55
- package/src/index.ts +1 -3
- package/src/testing/generator.ts +74 -64
- package/src/translations.ts +1 -1
- package/src/types.ts +39 -27
- package/src/util.ts +34 -15
- package/dist/types/src/components/MenuContext.d.ts +0 -13
- package/dist/types/src/components/MenuContext.d.ts.map +0 -1
- package/src/components/MenuContext.tsx +0 -50
|
@@ -2,12 +2,14 @@ import { type StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component:
|
|
5
|
+
component: React.ForwardRefExoticComponent<Omit<import("./Menu").MenuScopedProps<import("@dxos/react-ui").ToolbarRootProps>, "className"> & {
|
|
6
|
+
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
7
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
8
|
decorators: import("@storybook/react").Decorator[];
|
|
7
9
|
parameters: {
|
|
8
10
|
translations: [{
|
|
9
11
|
readonly 'en-US': {
|
|
10
|
-
readonly "react-ui-menu": {};
|
|
12
|
+
readonly "@dxos/react-ui-menu": {};
|
|
11
13
|
};
|
|
12
14
|
}];
|
|
13
15
|
};
|
|
@@ -16,5 +18,17 @@ export default meta;
|
|
|
16
18
|
type Story = StoryObj<typeof meta>;
|
|
17
19
|
export declare const DropdownMenu: Story;
|
|
18
20
|
export declare const Toolbar: Story;
|
|
21
|
+
/**
|
|
22
|
+
* Reactive toolbar driven by an atom-backed actions hook.
|
|
23
|
+
*
|
|
24
|
+
* Defining actions inside a hook lets them subscribe to reactive state
|
|
25
|
+
* (echo, atoms, settings) without re-rendering the toolbar shell.
|
|
26
|
+
* The menu structure is data, not JSX.
|
|
27
|
+
*
|
|
28
|
+
* @idiom org.dxos.react-ui-menu.toolbarMenu
|
|
29
|
+
* applies: Toolbars whose entries depend on reactive state
|
|
30
|
+
* instead-of: Hand-wired children inside a bespoke `Toolbar.Root`
|
|
31
|
+
* uses: {@link useMenuActions}, {@link Menu.Root}, {@link Menu.Toolbar}
|
|
32
|
+
*/
|
|
19
33
|
export declare const UseMenuActionsToolbar: Story;
|
|
20
34
|
//# sourceMappingURL=ToolbarMenu.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarMenu.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ToolbarMenu.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToolbarMenu.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ToolbarMenu.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAA8B,MAAM,OAAO,CAAC;AAenD,QAAA,MAAM,IAAI;;;;;;;;;;;;;CAO2B,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,YAAY,EAAE,KAsB1B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAWnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export type
|
|
1
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
2
|
+
import { type DependencyList } from 'react';
|
|
3
|
+
import { Graph, Node } from '@dxos/app-graph';
|
|
4
|
+
import { type MenuItemsAccessor } from '../types';
|
|
5
|
+
export type ActionGraphNodes = Node.NodeArg<any>[];
|
|
6
|
+
export type ActionGraphEdges = Graph.Edge[];
|
|
6
7
|
export type ActionGraphProps = {
|
|
7
8
|
nodes: ActionGraphNodes;
|
|
8
9
|
edges: ActionGraphEdges;
|
|
9
10
|
};
|
|
10
11
|
export type MenuActions = {
|
|
11
|
-
|
|
12
|
+
items: MenuItemsAccessor;
|
|
12
13
|
};
|
|
13
|
-
export declare const useMenuActions: (props:
|
|
14
|
+
export declare const useMenuActions: (props: Atom.Atom<ActionGraphProps>) => MenuActions;
|
|
15
|
+
/**
|
|
16
|
+
* Convenience wrapper around `useMenuActions` that creates the backing atom inline.
|
|
17
|
+
* Pass a builder thunk and a dependency list — the hook memoizes `Atom.make(build)` and threads
|
|
18
|
+
* it through `useMenuActions`. Saves the `useMemo(() => Atom.make(...), deps)` boilerplate when
|
|
19
|
+
* the action graph is composed from local state (e.g. a toolbar driven by component state).
|
|
20
|
+
*/
|
|
21
|
+
export declare const useMenuBuilder: (build: (get: Atom.Context) => ActionGraphProps, deps: DependencyList) => MenuActions;
|
|
14
22
|
//# sourceMappingURL=useMenuActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuActions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useMenuActions.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"useMenuActions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useMenuActions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAiC,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,KAAK,cAAc,EAAoC,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAqC,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAErF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AACnD,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;AAC5C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAG,WAuBnE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAAW,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,KAAK,gBAAgB,QAAQ,cAAc,KAAG,WAIrG,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { rxFromSignal } from '@dxos/app-graph';
|
|
2
1
|
export * from './components';
|
|
3
2
|
export * from './hooks';
|
|
4
3
|
export * from './types';
|
|
5
4
|
export { createMenuAction, createMenuItemGroup, createLineSeparator, createGapSeparator } from './util';
|
|
6
|
-
export { MenuBuilder } from './builder';
|
|
5
|
+
export { type ActionGroupBuilder, type ActionGroupBuilderFn, MenuBuilder } from './builder';
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACxG,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
2
|
+
import { Node } from '@dxos/app-graph';
|
|
3
3
|
import { type ActionGraphProps } from '../hooks/useMenuActions';
|
|
4
|
-
import { type
|
|
5
|
-
export type
|
|
6
|
-
type?: typeof
|
|
4
|
+
import { type MenuItemsAccessor } from '../types';
|
|
5
|
+
export type CreateActionsProps = Partial<{
|
|
6
|
+
type?: typeof Node.ActionType | typeof Node.ActionGroupType;
|
|
7
7
|
callback: () => void;
|
|
8
8
|
count: number;
|
|
9
9
|
}>;
|
|
10
|
-
export declare const createActions: (params?:
|
|
10
|
+
export declare const createActions: (params?: CreateActionsProps) => {
|
|
11
11
|
id: string;
|
|
12
|
-
type: "dxos.
|
|
12
|
+
type: "org.dxos.type.graphAction" | "org.dxos.type.graphActionGroup";
|
|
13
13
|
data: symbol | (() => void);
|
|
14
14
|
properties: {
|
|
15
|
-
variant?: string | undefined;
|
|
16
15
|
label: string;
|
|
17
16
|
icon: string;
|
|
18
17
|
disabled: boolean;
|
|
18
|
+
variant?: string | undefined;
|
|
19
19
|
};
|
|
20
|
-
}
|
|
21
|
-
export declare const createNestedActions:
|
|
22
|
-
export declare const createNestedActionsResolver: (
|
|
23
|
-
|
|
20
|
+
}[];
|
|
21
|
+
export declare const createNestedActions: Atom.Writable<ActionGraphProps, ActionGraphProps>;
|
|
22
|
+
export declare const createNestedActionsResolver: (props?: {
|
|
23
|
+
groupParams?: CreateActionsProps;
|
|
24
|
+
params?: CreateActionsProps;
|
|
25
|
+
registry?: Registry.Registry;
|
|
26
|
+
}) => {
|
|
27
|
+
items: MenuItemsAccessor;
|
|
24
28
|
};
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Hook to mutate actions in an atom on an interval for testing reactivity.
|
|
31
|
+
*/
|
|
32
|
+
export declare const useMutateActions: (actionsAtom: Atom.Writable<ActionGraphProps>) => void;
|
|
27
33
|
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAmB,MAAM,yBAAyB,CAAC;AAG1E,OAAO,EAAS,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAqC,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAErF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;IACvC,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC,UAAU,GAAG,OAAO,IAAI,CAAC,eAAe,CAAC;IAC5D,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAqBH,eAAO,MAAM,aAAa,YAAa,kBAAkB;;;0BAvBvC,IAAI;;;;;;;GAuCrB,CAAC;AAgBF,eAAO,MAAM,mBAAmB,mDAAuD,CAAC;AAExF,eAAO,MAAM,2BAA2B,WAAY;IAClD,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;CAC9B;;CAkBA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,gBAAiB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SA0B5E,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const translationKey = "react-ui-menu";
|
|
1
|
+
export declare const translationKey = "@dxos/react-ui-menu";
|
|
2
2
|
export declare const translations: [{
|
|
3
3
|
readonly 'en-US': {
|
|
4
|
-
readonly "react-ui-menu": {};
|
|
4
|
+
readonly "@dxos/react-ui-menu": {};
|
|
5
5
|
};
|
|
6
6
|
}];
|
|
7
7
|
//# sourceMappingURL=translations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,YAAY;;;;EAMM,CAAC"}
|
|
@@ -1,28 +1,13 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
hidden?: boolean;
|
|
9
|
-
iconOnly?: boolean;
|
|
10
|
-
testId?: string;
|
|
11
|
-
variant?: 'action' | 'toggle';
|
|
12
|
-
checked?: boolean;
|
|
13
|
-
classNames?: ClassNameValue;
|
|
14
|
-
};
|
|
15
|
-
export type MenuItemGroupProperties = {
|
|
16
|
-
label: Label;
|
|
17
|
-
icon?: string;
|
|
18
|
-
iconOnly?: boolean;
|
|
19
|
-
};
|
|
20
|
-
export type MenuAction<P extends {} = {}> = Action<P & MenuActionProperties>;
|
|
21
|
-
export declare const MenuSeparatorType: "@dxos/react-ui-toolbar/separator";
|
|
22
|
-
export type MenuSeparator = Node<never, Pick<ToolbarSeparatorProps, 'variant'>> & {
|
|
1
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
2
|
+
import { Node } from '@dxos/app-graph';
|
|
3
|
+
import { type IconButtonProps, type ToolbarSeparatorProps } from '@dxos/react-ui';
|
|
4
|
+
import { type MenuActionProperties } from '@dxos/ui-types';
|
|
5
|
+
export type MenuAction<P extends {} = {}> = Node.Action<P & MenuActionProperties>;
|
|
6
|
+
export declare const MenuSeparatorType: '@dxos/react-ui-toolbar/separator';
|
|
7
|
+
export type MenuSeparator = Node.Node<never, Pick<ToolbarSeparatorProps, 'variant'>> & {
|
|
23
8
|
type: typeof MenuSeparatorType;
|
|
24
9
|
};
|
|
25
|
-
export declare const isSeparator: (node: Node) => node is MenuSeparator;
|
|
10
|
+
export declare const isSeparator: (node: Node.Node) => node is MenuSeparator;
|
|
26
11
|
export type MenuSingleSelectActionGroup = {
|
|
27
12
|
selectCardinality: 'single';
|
|
28
13
|
value: string;
|
|
@@ -31,13 +16,39 @@ export type MenuMultipleSelectActionGroup = {
|
|
|
31
16
|
selectCardinality: 'multiple';
|
|
32
17
|
value: string[];
|
|
33
18
|
};
|
|
34
|
-
export type MenuItemGroup<P extends Record<string, any> = Record<string, any>> = ActionGroup<P>;
|
|
35
|
-
export declare const isMenuGroup: (node: Node) => node is MenuItemGroup;
|
|
19
|
+
export type MenuItemGroup<P extends Record<string, any> = Record<string, any>> = Node.ActionGroup<P>;
|
|
20
|
+
export declare const isMenuGroup: (node: Node.Node) => node is MenuItemGroup;
|
|
36
21
|
export type MenuItem = MenuSeparator | MenuAction | MenuItemGroup;
|
|
37
|
-
|
|
22
|
+
/** Atom-family-style accessor: returns an atom of items for a given group (or root when undefined). */
|
|
23
|
+
export type MenuItemsAccessor = (group?: MenuItemGroup) => Atom.Atom<MenuItem[] | null>;
|
|
24
|
+
export type ActionExecutor = (action: MenuAction, params: Node.InvokeProps) => void;
|
|
25
|
+
export type MenuItemsMode = 'additive' | 'replacement';
|
|
26
|
+
export type AddMenuItemsProps = {
|
|
27
|
+
id: string;
|
|
28
|
+
mode: MenuItemsMode;
|
|
29
|
+
priority?: number;
|
|
30
|
+
items: MenuItem[];
|
|
31
|
+
groupFilter?: (group?: MenuItemGroup) => boolean;
|
|
32
|
+
};
|
|
33
|
+
export type MenuItems = Omit<AddMenuItemsProps, 'priority'> & {
|
|
34
|
+
priority: number;
|
|
35
|
+
};
|
|
36
|
+
export type MenuItemsMap = Map<string, MenuItems>;
|
|
38
37
|
export type MenuContextValue = {
|
|
39
|
-
|
|
38
|
+
/** Atom-family accessor for base menu items, keyed by group (similar to Tree model). */
|
|
39
|
+
items: MenuItemsAccessor;
|
|
40
40
|
iconSize: IconButtonProps['size'];
|
|
41
41
|
attendableId?: string;
|
|
42
|
+
/** TODO(burdon): Remove and assume always active if attendableId is undefined. */
|
|
43
|
+
/** If true, the menu is always active regardless of attention state. */
|
|
44
|
+
alwaysActive?: boolean;
|
|
45
|
+
/** Atom holding the current set of imperatively added menu items. */
|
|
46
|
+
menuItemsAtom: Atom.Atom<MenuItemsMap>;
|
|
47
|
+
/** Imperatively add menu items to the nearest MenuProvider. */
|
|
48
|
+
addMenuItems: (props: AddMenuItemsProps) => void;
|
|
49
|
+
/** Remove previously added menu items by id. */
|
|
50
|
+
removeMenuItems: (id: string) => void;
|
|
51
|
+
/** Optional action executor. If provided, will be used instead of default execution. */
|
|
52
|
+
onAction?: ActionExecutor;
|
|
42
53
|
};
|
|
43
54
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types/src/util.d.ts
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Node } from '@dxos/app-graph';
|
|
3
|
+
import { type MenuActionProperties, type MenuItemGroupProperties } from '@dxos/ui-types';
|
|
4
|
+
import { type MenuAction } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Execute a menu action's Effect with its captured context.
|
|
7
|
+
* This provides the `_actionContext` layer if available.
|
|
8
|
+
*/
|
|
9
|
+
export declare const executeMenuAction: (action: MenuAction, params?: Node.InvokeProps) => Promise<void>;
|
|
10
|
+
export declare const getShortcut: (action: Node.ActionLike) => any;
|
|
4
11
|
export declare const fallbackIcon = "ph--placeholder--regular";
|
|
5
12
|
export declare const createMenuAction: <P extends {} = {}>(id: string, invoke: () => void, properties: P & MenuActionProperties) => {
|
|
6
13
|
id: string;
|
|
7
14
|
type: string;
|
|
8
15
|
properties: P & MenuActionProperties;
|
|
9
|
-
data: () => void
|
|
16
|
+
data: () => Effect.Effect<void, never, never>;
|
|
10
17
|
};
|
|
11
18
|
export declare const createMenuItemGroup: <P extends MenuItemGroupProperties = MenuItemGroupProperties & Partial<MenuActionProperties>>(id: string, properties: P) => {
|
|
12
19
|
id: string;
|
|
13
20
|
type: string;
|
|
14
21
|
properties: P;
|
|
15
|
-
data: typeof actionGroupSymbol;
|
|
22
|
+
data: typeof Node.actionGroupSymbol;
|
|
16
23
|
};
|
|
17
24
|
export declare const createGapSeparator: (id?: string, source?: string) => {
|
|
18
25
|
nodes: {
|
|
@@ -26,6 +33,7 @@ export declare const createGapSeparator: (id?: string, source?: string) => {
|
|
|
26
33
|
edges: {
|
|
27
34
|
source: string;
|
|
28
35
|
target: string;
|
|
36
|
+
relation: 'child';
|
|
29
37
|
}[];
|
|
30
38
|
};
|
|
31
39
|
export declare const createLineSeparator: (id?: string, source?: string) => {
|
|
@@ -40,6 +48,7 @@ export declare const createLineSeparator: (id?: string, source?: string) => {
|
|
|
40
48
|
edges: {
|
|
41
49
|
source: string;
|
|
42
50
|
target: string;
|
|
51
|
+
relation: 'child';
|
|
43
52
|
}[];
|
|
44
53
|
};
|
|
45
54
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzF,OAAO,EAAE,KAAK,UAAU,EAA0C,MAAM,SAAS,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WAAkB,UAAU,WAAU,IAAI,CAAC,WAAW,KAAQ,OAAO,CAAC,IAAI,CASvG,CAAC;AAEF,eAAO,MAAM,WAAW,WAAY,IAAI,CAAC,UAAU,QAIlD,CAAC;AAEF,eAAO,MAAM,YAAY,6BAA6B,CAAC;AAEvD,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,EAAE,WACvC,MAAM,UACF,MAAM,IAAI,cACN,CAAC,GAAG,oBAAoB;;;;;CAOb,CAAC;AAE1B,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,uBAAuB,gEAE7B,MAAM,cACE,CAAC;;;;;CAOa,CAAC;AAE7B,eAAO,MAAM,kBAAkB,QAAQ,MAAM,WAAkB,MAAM;;;;;;;cAM5C,KAAK;;;;;kBAOd,OAAO;;CAGrB,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAAQ,MAAM,WAAmB,MAAM;;;;;;;cAM9C,KAAK;;;;;kBAGY,OAAO;;CAC/C,CAAC"}
|