UNPKG

@sussudio/platform

Version:

Internal APIs for VS Code's service injection the base services.

133 lines (131 loc) 5.42 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { ActionViewItem, BaseActionViewItem } from '@sussudio/base/browser/ui/actionbar/actionViewItems.mjs'; import { DropdownMenuActionViewItem, IDropdownMenuActionViewItemOptions, } from '@sussudio/base/browser/ui/dropdown/dropdownActionViewItem.mjs'; import { IAction, SubmenuAction } from '@sussudio/base/common/actions.mjs'; import { Event } from '@sussudio/base/common/event.mjs'; import '../../../css!./menuEntryActionViewItem.mjs'; import { IMenu, IMenuActionOptions, IMenuService, MenuItemAction, SubmenuItemAction } from '../common/actions.mjs'; import { IContextKeyService } from '../../contextkey/common/contextkey.mjs'; import { IContextMenuService } from '../../contextview/browser/contextView.mjs'; import { IInstantiationService } from '../../instantiation/common/instantiation.mjs'; import { IKeybindingService } from '../../keybinding/common/keybinding.mjs'; import { INotificationService } from '../../notification/common/notification.mjs'; import { IStorageService } from '../../storage/common/storage.mjs'; import { IThemeService } from '../../theme/common/themeService.mjs'; import { IHoverDelegate } from '@sussudio/base/browser/ui/iconLabel/iconHoverDelegate.mjs'; export declare function createAndFillInContextMenuActions( menu: IMenu, options: IMenuActionOptions | undefined, target: | IAction[] | { primary: IAction[]; secondary: IAction[]; }, primaryGroup?: string, ): void; export declare function createAndFillInActionBarActions( menu: IMenu, options: IMenuActionOptions | undefined, target: | IAction[] | { primary: IAction[]; secondary: IAction[]; }, primaryGroup?: string | ((actionGroup: string) => boolean), shouldInlineSubmenu?: (action: SubmenuAction, group: string, groupSize: number) => boolean, useSeparatorsInPrimaryActions?: boolean, ): void; export interface IMenuEntryActionViewItemOptions { draggable?: boolean; keybinding?: string; hoverDelegate?: IHoverDelegate; } export declare class MenuEntryActionViewItem extends ActionViewItem { protected readonly _keybindingService: IKeybindingService; protected _notificationService: INotificationService; protected _contextKeyService: IContextKeyService; protected _themeService: IThemeService; protected _contextMenuService: IContextMenuService; private _wantsAltCommand; private readonly _itemClassDispose; private readonly _altKey; constructor( action: MenuItemAction, options: IMenuEntryActionViewItemOptions | undefined, _keybindingService: IKeybindingService, _notificationService: INotificationService, _contextKeyService: IContextKeyService, _themeService: IThemeService, _contextMenuService: IContextMenuService, ); protected get _menuItemAction(): MenuItemAction; protected get _commandAction(): MenuItemAction; onClick(event: MouseEvent): Promise<void>; render(container: HTMLElement): void; protected updateLabel(): void; protected getTooltip(): string; protected updateClass(): void; private _updateItemClass; } export declare class SubmenuEntryActionViewItem extends DropdownMenuActionViewItem { protected _contextMenuService: IContextMenuService; protected _themeService: IThemeService; constructor( action: SubmenuItemAction, options: IDropdownMenuActionViewItemOptions | undefined, _contextMenuService: IContextMenuService, _themeService: IThemeService, ); render(container: HTMLElement): void; } export interface IDropdownWithDefaultActionViewItemOptions extends IDropdownMenuActionViewItemOptions { renderKeybindingWithDefaultActionLabel?: boolean; } export declare class DropdownWithDefaultActionViewItem extends BaseActionViewItem { protected readonly _keybindingService: IKeybindingService; protected _notificationService: INotificationService; protected _contextMenuService: IContextMenuService; protected _menuService: IMenuService; protected _instaService: IInstantiationService; protected _storageService: IStorageService; private readonly _options; private _defaultAction; private _dropdown; private _container; private _storageKey; get onDidChangeDropdownVisibility(): Event<boolean>; constructor( submenuAction: SubmenuItemAction, options: IDropdownWithDefaultActionViewItemOptions | undefined, _keybindingService: IKeybindingService, _notificationService: INotificationService, _contextMenuService: IContextMenuService, _menuService: IMenuService, _instaService: IInstantiationService, _storageService: IStorageService, ); private update; private _getDefaultActionKeybindingLabel; setActionContext(newContext: unknown): void; render(container: HTMLElement): void; focus(fromRight?: boolean): void; blur(): void; setFocusable(focusable: boolean): void; dispose(): void; } /** * Creates action view items for menu actions or submenu actions. */ export declare function createActionViewItem( instaService: IInstantiationService, action: IAction, options?: IDropdownMenuActionViewItemOptions | IMenuEntryActionViewItemOptions, ): undefined | MenuEntryActionViewItem | SubmenuEntryActionViewItem | BaseActionViewItem;