@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
56 lines • 2.31 kB
TypeScript
import { MenuPath } from '../common/menu';
import { Disposable, DisposableCollection } from '../common/disposable';
import { ContextMatcher } from './context-key-service';
export interface Coordinate {
x: number;
y: number;
}
export declare const Coordinate: unique symbol;
export declare type Anchor = MouseEvent | Coordinate;
export declare function toAnchor(anchor: HTMLElement | Coordinate): Anchor;
export declare function coordinateFromAnchor(anchor: Anchor): Coordinate;
export declare abstract class ContextMenuAccess implements Disposable {
protected readonly toDispose: DisposableCollection;
readonly onDispose: import("../common").Event<void>;
constructor(toClose: Disposable);
get disposed(): boolean;
dispose(): void;
}
export declare abstract class ContextMenuRenderer {
protected _current: ContextMenuAccess | undefined;
protected readonly toDisposeOnSetCurrent: DisposableCollection;
/**
* Currently opened context menu.
* Rendering a new context menu will close the current.
*/
get current(): ContextMenuAccess | undefined;
protected setCurrent(current: ContextMenuAccess | undefined): void;
render(options: RenderContextMenuOptions): ContextMenuAccess;
protected abstract doRender(options: RenderContextMenuOptions): ContextMenuAccess;
protected resolve(options: RenderContextMenuOptions): RenderContextMenuOptions;
}
export interface RenderContextMenuOptions {
menuPath: MenuPath;
anchor: Anchor;
args?: any[];
/**
* Whether the anchor should be passed as an argument to the handlers of commands for this context menu.
* If true, the anchor will be appended to the list of arguments or passed as the only argument if no other
* arguments are supplied.
* Default is `true`.
*/
includeAnchorArg?: boolean;
/**
* A DOM context to use when evaluating any `when` clauses
* of menu items registered for this item.
*/
context?: HTMLElement;
contextKeyService?: ContextMatcher;
onHide?: () => void;
/**
* If true a single submenu in the context menu is not rendered but its children are rendered on the top level.
* Default is `false`.
*/
skipSingleRootNode?: boolean;
}
//# sourceMappingURL=context-menu-renderer.d.ts.map