@sussudio/platform
Version:
Internal APIs for VS Code's service injection the base services.
68 lines (66 loc) • 2.7 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IContextMenuDelegate } from '@sussudio/base/browser/contextmenu.mjs';
import {
AnchorAlignment,
AnchorAxisAlignment,
IContextViewProvider,
} from '@sussudio/base/browser/ui/contextview/contextview.mjs';
import { IAction } from '@sussudio/base/common/actions.mjs';
import { Event } from '@sussudio/base/common/event.mjs';
import { IDisposable } from '@sussudio/base/common/lifecycle.mjs';
import { IMenuActionOptions, MenuId } from '../../actions/common/actions.mjs';
import { IContextKeyService } from '../../contextkey/common/contextkey.mjs';
export declare const IContextViewService: import('../../instantiation/common/instantiation.mjs').ServiceIdentifier<IContextViewService>;
export interface IContextViewService extends IContextViewProvider {
readonly _serviceBrand: undefined;
showContextView(delegate: IContextViewDelegate, container?: HTMLElement, shadowRoot?: boolean): IDisposable;
hideContextView(data?: any): void;
getContextViewElement(): HTMLElement;
layout(): void;
anchorAlignment?: AnchorAlignment;
}
export interface IContextViewDelegate {
canRelayout?: boolean;
getAnchor():
| HTMLElement
| {
x: number;
y: number;
width?: number;
height?: number;
};
render(container: HTMLElement): IDisposable;
onDOMEvent?(e: any, activeElement: HTMLElement): void;
onHide?(data?: any): void;
focus?(): void;
anchorAlignment?: AnchorAlignment;
anchorAxisAlignment?: AnchorAxisAlignment;
}
export declare const IContextMenuService: import('../../instantiation/common/instantiation.mjs').ServiceIdentifier<IContextMenuService>;
export interface IContextMenuService {
readonly _serviceBrand: undefined;
readonly onDidShowContextMenu: Event<void>;
readonly onDidHideContextMenu: Event<void>;
showContextMenu(delegate: IContextMenuDelegate | IContextMenuMenuDelegate): void;
}
export type IContextMenuMenuDelegate = {
/**
* The MenuId that should be used to populate the context menu.
*/
menuId?: MenuId;
/**
* Optional options how menu actions are invoked
*/
menuActionOptions?: IMenuActionOptions;
/**
* Optional context key service which drives the given menu
*/
contextKeyService?: IContextKeyService;
/**
* Optional getter for extra actions. They will be prepended to the menu actions.
*/
getActions?(): IAction[];
} & Omit<IContextMenuDelegate, 'getActions'>;