UNPKG

2.23 kBTypeScriptView Raw
1import { MenuPath } from '../common/menu';
2import { Disposable, DisposableCollection } from '../common/disposable';
3import { ContextMatcher } from './context-key-service';
4export interface Coordinate {
5 x: number;
6 y: number;
7}
8export declare const Coordinate: unique symbol;
9export declare type Anchor = MouseEvent | Coordinate;
10export declare function coordinateFromAnchor(anchor: Anchor): Coordinate;
11export declare abstract class ContextMenuAccess implements Disposable {
12 protected readonly toDispose: DisposableCollection;
13 readonly onDispose: import("../common").Event<void>;
14 constructor(toClose: Disposable);
15 get disposed(): boolean;
16 dispose(): void;
17}
18export declare abstract class ContextMenuRenderer {
19 protected _current: ContextMenuAccess | undefined;
20 protected readonly toDisposeOnSetCurrent: DisposableCollection;
21 /**
22 * Currently opened context menu.
23 * Rendering a new context menu will close the current.
24 */
25 get current(): ContextMenuAccess | undefined;
26 protected setCurrent(current: ContextMenuAccess | undefined): void;
27 render(options: RenderContextMenuOptions): ContextMenuAccess;
28 protected abstract doRender(options: RenderContextMenuOptions): ContextMenuAccess;
29 protected resolve(options: RenderContextMenuOptions): RenderContextMenuOptions;
30}
31export interface RenderContextMenuOptions {
32 menuPath: MenuPath;
33 anchor: Anchor;
34 args?: any[];
35 /**
36 * Whether the anchor should be passed as an argument to the handlers of commands for this context menu.
37 * If true, the anchor will be appended to the list of arguments or passed as the only argument if no other
38 * arguments are supplied.
39 * Default is `true`.
40 */
41 includeAnchorArg?: boolean;
42 /**
43 * A DOM context to use when evaluating any `when` clauses
44 * of menu items registered for this item.
45 */
46 context?: HTMLElement;
47 contextKeyService?: ContextMatcher;
48 onHide?: () => void;
49 /**
50 * If true a single submenu in the context menu is not rendered but its children are rendered on the top level.
51 * Default is `false`.
52 */
53 skipSingleRootNode?: boolean;
54}
55//# sourceMappingURL=context-menu-renderer.d.ts.map
\No newline at end of file