UNPKG

2.11 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 toAnchor(anchor: HTMLElement | Coordinate): Anchor;
11export declare function coordinateFromAnchor(anchor: Anchor): Coordinate;
12export declare abstract class ContextMenuAccess implements Disposable {
13 protected readonly toDispose: DisposableCollection;
14 readonly onDispose: import("../common").Event<void>;
15 constructor(toClose: Disposable);
16 get disposed(): boolean;
17 dispose(): void;
18}
19export declare abstract class ContextMenuRenderer {
20 protected _current: ContextMenuAccess | undefined;
21 protected readonly toDisposeOnSetCurrent: DisposableCollection;
22 /**
23 * Currently opened context menu.
24 * Rendering a new context menu will close the current.
25 */
26 get current(): ContextMenuAccess | undefined;
27 protected setCurrent(current: ContextMenuAccess | undefined): void;
28 render(options: RenderContextMenuOptions): ContextMenuAccess;
29 protected abstract doRender(options: RenderContextMenuOptions): ContextMenuAccess;
30 protected resolve(options: RenderContextMenuOptions): RenderContextMenuOptions;
31}
32export interface RenderContextMenuOptions {
33 menuPath: MenuPath;
34 anchor: Anchor;
35 args?: any[];
36 /**
37 * Whether the anchor should be passed as an argument to the handlers of commands for this context menu.
38 * If true, the anchor will be appended to the list of arguments or passed as the only argument if no other
39 * arguments are supplied.
40 * Default is `true`.
41 */
42 includeAnchorArg?: boolean;
43 /**
44 * A DOM context to use when evaluating any `when` clauses
45 * of menu items registered for this item.
46 */
47 context?: HTMLElement;
48 contextKeyService?: ContextMatcher;
49 onHide?: () => void;
50}
51//# sourceMappingURL=context-menu-renderer.d.ts.map
\No newline at end of file