1 | import { ContributionProvider, CommandRegistry, MenuModelRegistry, BackendStopwatch, Stopwatch } from '../common';
|
2 | import { MaybePromise } from '../common/types';
|
3 | import { KeybindingRegistry } from './keybinding';
|
4 | import { ApplicationShell } from './shell/application-shell';
|
5 | import { ShellLayoutRestorer } from './shell/shell-layout-restorer';
|
6 | import { FrontendApplicationStateService } from './frontend-application-state';
|
7 | import { CorePreferences } from './core-preferences';
|
8 | import { WindowService } from './window/window-service';
|
9 | import { TooltipService } from './tooltip-service';
|
10 | import { StopReason } from '../common/frontend-application-state';
|
11 |
|
12 |
|
13 |
|
14 | export declare const FrontendApplicationContribution: unique symbol;
|
15 | export interface FrontendApplicationContribution {
|
16 | |
17 |
|
18 |
|
19 | initialize?(): void;
|
20 | |
21 |
|
22 |
|
23 |
|
24 | configure?(app: FrontendApplication): MaybePromise<void>;
|
25 | |
26 |
|
27 |
|
28 |
|
29 | onStart?(app: FrontendApplication): MaybePromise<void>;
|
30 | |
31 |
|
32 |
|
33 |
|
34 |
|
35 | onWillStop?(app: FrontendApplication): boolean | undefined | OnWillStopAction<unknown>;
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | onStop?(app: FrontendApplication): void;
|
43 | |
44 |
|
45 |
|
46 |
|
47 | initializeLayout?(app: FrontendApplication): MaybePromise<void>;
|
48 | |
49 |
|
50 |
|
51 | onDidInitializeLayout?(app: FrontendApplication): MaybePromise<void>;
|
52 | }
|
53 | export interface OnWillStopAction<T = unknown> {
|
54 | |
55 |
|
56 |
|
57 | prepare?: (stopReason?: StopReason) => MaybePromise<T>;
|
58 | |
59 |
|
60 |
|
61 | action: (prepared: T, stopReason?: StopReason) => MaybePromise<boolean>;
|
62 | |
63 |
|
64 |
|
65 | reason: string;
|
66 | |
67 |
|
68 |
|
69 |
|
70 |
|
71 | priority?: number;
|
72 | }
|
73 | export declare namespace OnWillStopAction {
|
74 | function is(candidate: unknown): candidate is OnWillStopAction;
|
75 | }
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | export declare abstract class DefaultFrontendApplicationContribution implements FrontendApplicationContribution {
|
81 | initialize(): void;
|
82 | }
|
83 | export declare class FrontendApplication {
|
84 | protected readonly commands: CommandRegistry;
|
85 | protected readonly menus: MenuModelRegistry;
|
86 | protected readonly keybindings: KeybindingRegistry;
|
87 | protected readonly layoutRestorer: ShellLayoutRestorer;
|
88 | protected readonly contributions: ContributionProvider<FrontendApplicationContribution>;
|
89 | protected readonly _shell: ApplicationShell;
|
90 | protected readonly stateService: FrontendApplicationStateService;
|
91 | protected readonly corePreferences: CorePreferences;
|
92 | protected readonly windowsService: WindowService;
|
93 | protected readonly tooltipService: TooltipService;
|
94 | protected readonly stopwatch: Stopwatch;
|
95 | protected readonly backendStopwatch: BackendStopwatch;
|
96 | constructor(commands: CommandRegistry, menus: MenuModelRegistry, keybindings: KeybindingRegistry, layoutRestorer: ShellLayoutRestorer, contributions: ContributionProvider<FrontendApplicationContribution>, _shell: ApplicationShell, stateService: FrontendApplicationStateService);
|
97 | get shell(): ApplicationShell;
|
98 | /**
|
99 | * Start the frontend application.
|
100 | *
|
101 | * Start up consists of the following steps:
|
102 | * - start frontend contributions
|
103 | * - attach the application shell to the host element
|
104 | * - initialize the application shell layout
|
105 | * - reveal the application shell if it was hidden by a startup indicator
|
106 | */
|
107 | start(): Promise<void>;
|
108 | /**
|
109 | * Return a promise to the host element to which the application shell is attached.
|
110 | */
|
111 | protected getHost(): Promise<HTMLElement>;
|
112 | /**
|
113 | * Return an HTML element that indicates the startup phase, e.g. with an animation or a splash screen.
|
114 | */
|
115 | protected getStartupIndicator(host: HTMLElement): HTMLElement | undefined;
|
116 | /**
|
117 | * Register global event listeners.
|
118 | */
|
119 | protected registerEventListeners(): void;
|
120 | /**
|
121 | * Attach the application shell to the host element. If a startup indicator is present, the shell is
|
122 | * inserted before that indicator so it is not visible yet.
|
123 | */
|
124 | protected attachShell(host: HTMLElement): void;
|
125 | /**
|
126 | * Attach the tooltip container to the host element.
|
127 | */
|
128 | protected attachTooltip(host: HTMLElement): void;
|
129 | /**
|
130 | * If a startup indicator is present, it is first hidden with the `theia-hidden` CSS class and then
|
131 | * removed after a while. The delay until removal is taken from the CSS transition duration.
|
132 | */
|
133 | protected revealShell(host: HTMLElement): Promise<void>;
|
134 | /**
|
135 | * Initialize the shell layout either using the layout restorer service or, if no layout has
|
136 | * been stored, by creating the default layout.
|
137 | */
|
138 | protected initializeLayout(): Promise<void>;
|
139 | /**
|
140 | * Try to restore the shell layout from the storage service. Resolves to `true` if successful.
|
141 | */
|
142 | protected restoreLayout(): Promise<boolean>;
|
143 | /**
|
144 | * Let the frontend application contributions initialize the shell layout. Override this
|
145 | * method in order to create an application-specific custom layout.
|
146 | */
|
147 | protected createDefaultLayout(): Promise<void>;
|
148 | protected fireOnDidInitializeLayout(): Promise<void>;
|
149 | /**
|
150 | * Initialize and start the frontend application contributions.
|
151 | */
|
152 | protected startContributions(): Promise<void>;
|
153 | /**
|
154 | * Stop the frontend application contributions. This is called when the window is unloaded.
|
155 | */
|
156 | protected stopContributions(): void;
|
157 | protected measure<T>(name: string, fn: () => MaybePromise<T>, message?: string, threshold?: boolean): Promise<T>;
|
158 | }
|
159 | //# sourceMappingURL=frontend-application.d.ts.map |
\ | No newline at end of file |