UNPKG

4.87 kBTypeScriptView Raw
1import { NativeKeyboardLayout } from '../common/keyboard/keyboard-layout-provider';
2import { Disposable } from '../common';
3import { FrontendApplicationState, StopReason } from '../common/frontend-application-state';
4export declare type MenuRole = ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'selectAll' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit');
5export interface MenuDto {
6 id?: string;
7 label?: string;
8 submenu?: MenuDto[];
9 type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
10 checked?: boolean;
11 enabled?: boolean;
12 visible?: boolean;
13 role?: MenuRole;
14 accelerator?: string;
15 execute?: () => void;
16}
17export declare type InternalMenuDto = Omit<MenuDto, 'execute' | 'submenu'> & {
18 submenu?: InternalMenuDto[];
19 handlerId?: number;
20};
21export declare type WindowEvent = 'maximize' | 'unmaximize' | 'focus';
22export interface TheiaCoreAPI {
23 getSecurityToken: () => string;
24 attachSecurityToken: (endpoint: string) => Promise<void>;
25 setMenuBarVisible(visible: boolean, windowName?: string): void;
26 setMenu(menu: MenuDto[] | undefined): void;
27 popup(menu: MenuDto[], x: number, y: number, onClosed: () => void): Promise<number>;
28 closePopup(handle: number): void;
29 focusWindow(name: string): void;
30 showItemInFolder(fsPath: string): void;
31 getTitleBarStyleAtStartup(): Promise<string>;
32 setTitleBarStyle(style: string): void;
33 setBackgroundColor(backgroundColor: string): void;
34 minimize(): void;
35 isMaximized(): boolean;
36 maximize(): void;
37 unMaximize(): void;
38 close(): void;
39 onWindowEvent(event: WindowEvent, handler: () => void): Disposable;
40 setCloseRequestHandler(handler: (reason: StopReason) => Promise<boolean>): void;
41 setSecondaryWindowCloseRequestHandler(windowName: string, handler: () => Promise<boolean>): void;
42 toggleDevTools(): void;
43 getZoomLevel(): Promise<number>;
44 setZoomLevel(desired: number): void;
45 isFullScreenable(): boolean;
46 isFullScreen(): boolean;
47 toggleFullScreen(): void;
48 requestReload(): void;
49 restart(): void;
50 applicationStateChanged(state: FrontendApplicationState): void;
51 readClipboard(): string;
52 writeClipboard(text: string): void;
53 onKeyboardLayoutChanged(handler: (newLayout: NativeKeyboardLayout) => void): Disposable;
54 sendData(data: Uint8Array): void;
55 onData(handler: (data: Uint8Array) => void): Disposable;
56}
57declare global {
58 interface Window {
59 electronTheiaCore: TheiaCoreAPI;
60 }
61}
62export declare const CHANNEL_SET_MENU = "SetMenu";
63export declare const CHANNEL_SET_MENU_BAR_VISIBLE = "SetMenuBarVisible";
64export declare const CHANNEL_INVOKE_MENU = "InvokeMenu";
65export declare const CHANNEL_OPEN_POPUP = "OpenPopup";
66export declare const CHANNEL_ON_CLOSE_POPUP = "OnClosePopup";
67export declare const CHANNEL_CLOSE_POPUP = "ClosePopup";
68export declare const CHANNEL_GET_SECURITY_TOKEN = "GetSecurityToken";
69export declare const CHANNEL_FOCUS_WINDOW = "FocusWindow";
70export declare const CHANNEL_SHOW_OPEN = "ShowOpenDialog";
71export declare const CHANNEL_SHOW_SAVE = "ShowSaveDialog";
72export declare const CHANNEL_SHOW_ITEM_IN_FOLDER = "ShowItemInFolder";
73export declare const CHANNEL_ATTACH_SECURITY_TOKEN = "AttachSecurityToken";
74export declare const CHANNEL_GET_TITLE_STYLE_AT_STARTUP = "GetTitleStyleAtStartup";
75export declare const CHANNEL_SET_TITLE_STYLE = "SetTitleStyle";
76export declare const CHANNEL_SET_BACKGROUND_COLOR = "SetBackgroundColor";
77export declare const CHANNEL_CLOSE = "Close";
78export declare const CHANNEL_MINIMIZE = "Minimize";
79export declare const CHANNEL_MAXIMIZE = "Maximize";
80export declare const CHANNEL_IS_MAXIMIZED = "IsMaximized";
81export declare const CHANNEL_UNMAXIMIZE = "UnMaximize";
82export declare const CHANNEL_ON_WINDOW_EVENT = "OnWindowEvent";
83export declare const CHANNEL_TOGGLE_DEVTOOLS = "ToggleDevtools";
84export declare const CHANNEL_GET_ZOOM_LEVEL = "GetZoomLevel";
85export declare const CHANNEL_SET_ZOOM_LEVEL = "SetZoomLevel";
86export declare const CHANNEL_IS_FULL_SCREENABLE = "IsFullScreenable";
87export declare const CHANNEL_IS_FULL_SCREEN = "IsFullScreen";
88export declare const CHANNEL_TOGGLE_FULL_SCREEN = "ToggleFullScreen";
89export declare const CHANNEL_REQUEST_SECONDARY_CLOSE = "RequestSecondaryClose";
90export declare const CHANNEL_REQUEST_CLOSE = "RequestClose";
91export declare const CHANNEL_REQUEST_RELOAD = "RequestReload";
92export declare const CHANNEL_RESTART = "Restart";
93export declare const CHANNEL_APP_STATE_CHANGED = "ApplicationStateChanged";
94export declare const CHANNEL_READ_CLIPBOARD = "ReadClipboard";
95export declare const CHANNEL_WRITE_CLIPBOARD = "WriteClipboard";
96export declare const CHANNEL_KEYBOARD_LAYOUT_CHANGED = "KeyboardLayoutChanged";
97export declare const CHANNEL_IPC_CONNECTION = "IpcConnection";
98//# sourceMappingURL=electron-api.d.ts.map
\No newline at end of file