1 | import { MenuBar, Menu as MenuWidget, Widget } from '@phosphor/widgets';
|
2 | import { CommandRegistry as PhosphorCommandRegistry } from '@phosphor/commands';
|
3 | import { CommandRegistry, DisposableCollection, Disposable, MenuModelRegistry, MenuPath, MenuNode, MenuCommandExecutor, CompoundMenuNode, CommandMenuNode } from '../../common';
|
4 | import { KeybindingRegistry } from '../keybinding';
|
5 | import { FrontendApplication } from '../frontend-application';
|
6 | import { FrontendApplicationContribution } from '../frontend-application-contribution';
|
7 | import { ContextKeyService, ContextMatcher } from '../context-key-service';
|
8 | import { ContextMenuContext } from './context-menu-context';
|
9 | import { ApplicationShell } from '../shell';
|
10 | import { CorePreferences } from '../core-preferences';
|
11 | import { PreferenceService } from '../preferences/preference-service';
|
12 | export declare abstract class MenuBarWidget extends MenuBar {
|
13 | abstract activateMenu(label: string, ...labels: string[]): Promise<MenuWidget>;
|
14 | abstract triggerMenuItem(label: string, ...labels: string[]): Promise<MenuWidget.IItem>;
|
15 | }
|
16 | export interface BrowserMenuOptions extends MenuWidget.IOptions {
|
17 | commands: MenuCommandRegistry;
|
18 | context?: HTMLElement;
|
19 | contextKeyService?: ContextMatcher;
|
20 | rootMenuPath: MenuPath;
|
21 | }
|
22 | export declare class BrowserMainMenuFactory implements MenuWidgetFactory {
|
23 | protected readonly contextKeyService: ContextKeyService;
|
24 | protected readonly context: ContextMenuContext;
|
25 | protected readonly commandRegistry: CommandRegistry;
|
26 | protected readonly menuCommandExecutor: MenuCommandExecutor;
|
27 | protected readonly corePreferences: CorePreferences;
|
28 | protected readonly keybindingRegistry: KeybindingRegistry;
|
29 | protected readonly menuProvider: MenuModelRegistry;
|
30 | createMenuBar(): MenuBarWidget;
|
31 | protected showMenuBar(menuBar: DynamicMenuBarWidget, preference: string | undefined): void;
|
32 | protected fillMenuBar(menuBar: MenuBarWidget): void;
|
33 | createContextMenu(path: MenuPath, args?: unknown[], context?: HTMLElement, contextKeyService?: ContextMatcher, skipSingleRootNode?: boolean): MenuWidget;
|
34 | createMenuWidget(menu: CompoundMenuNode, options: BrowserMenuOptions): DynamicMenuWidget;
|
35 | protected createMenuCommandRegistry(menu: CompoundMenuNode, args?: unknown[]): MenuCommandRegistry;
|
36 | protected registerMenu(menuCommandRegistry: MenuCommandRegistry, menu: MenuNode, args: unknown[]): void;
|
37 | protected get services(): MenuServices;
|
38 | }
|
39 | export declare class DynamicMenuBarWidget extends MenuBarWidget {
|
40 | |
41 |
|
42 |
|
43 | protected previousFocusedElement: HTMLElement | undefined;
|
44 | constructor();
|
45 | activateMenu(label: string, ...labels: string[]): Promise<MenuWidget>;
|
46 | triggerMenuItem(label: string, ...labels: string[]): Promise<MenuWidget.IItem>;
|
47 | }
|
48 | export declare class MenuServices {
|
49 | readonly commandRegistry: CommandRegistry;
|
50 | readonly keybindingRegistry: KeybindingRegistry;
|
51 | readonly contextKeyService: ContextKeyService;
|
52 | readonly context: ContextMenuContext;
|
53 | readonly menuWidgetFactory: MenuWidgetFactory;
|
54 | readonly commandExecutor: MenuCommandExecutor;
|
55 | }
|
56 | export interface MenuWidgetFactory {
|
57 | createMenuWidget(menu: MenuNode & Required<Pick<MenuNode, 'children'>>, options: BrowserMenuOptions): MenuWidget;
|
58 | }
|
59 |
|
60 |
|
61 |
|
62 | export declare class DynamicMenuWidget extends MenuWidget {
|
63 | protected menu: CompoundMenuNode;
|
64 | protected options: BrowserMenuOptions;
|
65 | protected services: MenuServices;
|
66 | |
67 |
|
68 |
|
69 | protected previousFocusedElement: HTMLElement | undefined;
|
70 | constructor(menu: CompoundMenuNode, options: BrowserMenuOptions, services: MenuServices);
|
71 | aboutToShow({ previousFocusedElement }: {
|
72 | previousFocusedElement: HTMLElement | undefined;
|
73 | }): void;
|
74 | open(x: number, y: number, options?: MenuWidget.IOpenOptions): void;
|
75 | protected updateSubMenus(parent: MenuWidget, menu: CompoundMenuNode, commands: MenuCommandRegistry): void;
|
76 | protected buildSubMenus(parentItems: MenuWidget.IItemOptions[], menu: MenuNode, commands: MenuCommandRegistry): MenuWidget.IItemOptions[];
|
77 | protected undefinedOrMatch(contextKeyService: ContextMatcher, expression?: string, context?: HTMLElement): boolean;
|
78 | protected preserveFocusedElement(previousFocusedElement?: Element | null): boolean;
|
79 | protected restoreFocusedElement(): boolean;
|
80 | protected runWithPreservedFocusContext(what: () => void): void;
|
81 | }
|
82 | export declare class BrowserMenuBarContribution implements FrontendApplicationContribution {
|
83 | protected readonly factory: BrowserMainMenuFactory;
|
84 | protected readonly shell: ApplicationShell;
|
85 | protected readonly preferenceService: PreferenceService;
|
86 | constructor(factory: BrowserMainMenuFactory);
|
87 | onStart(app: FrontendApplication): void;
|
88 | get menuBar(): MenuBarWidget | undefined;
|
89 | protected appendMenu(shell: ApplicationShell): void;
|
90 | protected createLogo(): Widget;
|
91 | }
|
92 | /**
|
93 | * Stores Theia-specific action menu nodes instead of PhosphorJS commands with their handlers.
|
94 | */
|
95 | export declare class MenuCommandRegistry extends PhosphorCommandRegistry {
|
96 | protected services: MenuServices;
|
97 | protected actions: Map<string, [import("../../common").MenuNodeMetadata & import("../../common").MenuNodeRenderingData & Partial<CompoundMenuNode> & Partial<CommandMenuNode> & Partial<import("../../common").AlternativeHandlerMenuNode> & CommandMenuNode, unknown[]]>;
|
98 | protected toDispose: DisposableCollection;
|
99 | constructor(services: MenuServices);
|
100 | registerActionMenu(menu: MenuNode & CommandMenuNode, args: unknown[]): void;
|
101 | snapshot(menuPath: MenuPath): this;
|
102 | protected registerCommand(menu: MenuNode & CommandMenuNode, args: unknown[], menuPath: MenuPath): Disposable;
|
103 | }
|
104 | //# sourceMappingURL=browser-menu-plugin.d.ts.map |
\ | No newline at end of file |