From 2618f454e07cb5471a1f150fb2fcd2ecd595854b Mon Sep 17 00:00:00 2001 From: Emil Pettersson Date: Mon, 8 Mar 2021 15:06:23 +0100 Subject: [PATCH] Updated for v13.0.0-wvvmp-beta.2 --- electron.d.ts | 287 +++++++++++++++++++++++++++----------------------- index.js | 11 +- package.json | 2 +- 3 files changed, 164 insertions(+), 136 deletions(-) diff --git a/electron.d.ts b/electron.d.ts index 70ce70e..9d82186 100644 --- a/electron.d.ts +++ b/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 12.0.0-beta.31 +// Type definitions for Electron 13.0.0-beta.2 // Project: http://electronjs.org/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -2226,39 +2226,6 @@ Calling `event.preventDefault()` will prevent the menu from being displayed. * BrowserWindow */ constructor(options?: BrowserWindowConstructorOptions); - /** - * Adds DevTools extension located at `path`, and returns extension's name. - * - * The extension will be remembered so you only need to call this API once, this - * API is not for programming use. If you try to add an extension that has already - * been loaded, this method will not return and instead log a warning to the - * console. - * - * The method will also not return if the extension's manifest is missing or - * incomplete. - * - * **Note:** This API cannot be called before the `ready` event of the `app` module - * is emitted. - * -**Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`. - * - * @deprecated - */ - static addDevToolsExtension(path: string): void; - /** - * Adds Chrome extension located at `path`, and returns extension's name. - * - * The method will also not return if the extension's manifest is missing or - * incomplete. - * - * **Note:** This API cannot be called before the `ready` event of the `app` module - * is emitted. - * -**Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`. - * - * @deprecated - */ - static addExtension(path: string): void; /** * The window that owns the given `browserView`. If the given view is not attached * to any window, returns `null`. @@ -2277,60 +2244,10 @@ Calling `event.preventDefault()` will prevent the menu from being displayed. * An array of all opened browser windows. */ static getAllWindows(): BrowserWindow[]; - /** - * The keys are the extension names and each value is an Object containing `name` - * and `version` properties. - * - * To check if a DevTools extension is installed you can run the following: - * - * **Note:** This API cannot be called before the `ready` event of the `app` module - * is emitted. - * -**Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`. - * - * @deprecated - */ - static getDevToolsExtensions(): Record; - /** - * The keys are the extension names and each value is an Object containing `name` - * and `version` properties. - * - * **Note:** This API cannot be called before the `ready` event of the `app` module - * is emitted. - * -**Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`. - * - * @deprecated - */ - static getExtensions(): Record; /** * The window that is focused in this application, otherwise returns `null`. */ static getFocusedWindow(): (BrowserWindow) | (null); - /** - * Remove a DevTools extension by name. - * - * **Note:** This API cannot be called before the `ready` event of the `app` module - * is emitted. - * - * **Note:** This method is deprecated. Instead, use - * `ses.removeExtension(extension_id)`. - * - * @deprecated - */ - static removeDevToolsExtension(name: string): void; - /** - * Remove a Chrome extension by name. - * - * **Note:** This API cannot be called before the `ready` event of the `app` module - * is emitted. - * - * **Note:** This method is deprecated. Instead, use - * `ses.removeExtension(extension_id)`. - * - * @deprecated - */ - static removeExtension(name: string): void; /** * Replacement API for setBrowserView supporting work with multi browser views. * @@ -2488,8 +2405,7 @@ Calling `event.preventDefault()` will prevent the menu from being displayed. */ getTitle(): string; /** - * The current position for the traffic light buttons. Can only be used with - * `titleBarStyle` set to `hidden`. + * The custom position for the traffic light buttons in frameless window. * * @platform darwin */ @@ -3070,8 +2986,7 @@ On macOS it does not remove the focus from the window. */ setTouchBar(touchBar: (TouchBar) | (null)): void; /** - * Set a custom position for the traffic light buttons. Can only be used with - * `titleBarStyle` set to `hidden`. + * Set a custom position for the traffic light buttons in frameless window. * * @platform darwin */ @@ -3094,8 +3009,6 @@ On macOS it does not remove the focus from the window. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void; /** * Sets whether the window traffic light buttons should be visible. - * -This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`. * * @platform darwin */ @@ -4048,8 +3961,10 @@ Send given command to the debugging target. /** * The identifier of a window or screen that can be used as a `chromeMediaSourceId` * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the - * identifier will be `window:XX` or `screen:XX`, where `XX` is a random generated - * number. + * identifier will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. + * YY is 1 for the current process, and 0 for all others. ZZ is a sequential number + * that represents the screen, and it does not equal to the index in the source's + * name. */ id: string; /** @@ -4327,6 +4242,9 @@ Send given command to the debugging target. * Can be `available`, `unavailable`, `unknown`. */ accelerometerSupport: ('available' | 'unavailable' | 'unknown'); + /** + * the bounds of the display in DIP points. + */ bounds: Rectangle; /** * The number of bits per pixel. @@ -4370,6 +4288,9 @@ Send given command to the debugging target. * Can be `available`, `unavailable`, `unknown`. */ touchSupport: ('available' | 'unavailable' | 'unknown'); + /** + * the work area of the display in DIP points. + */ workArea: Rectangle; workAreaSize: Size; } @@ -4974,6 +4895,10 @@ Retrieves the product descriptions. * The `event` that is passed as the first argument to the handler is the same as * that passed to a regular event listener. It includes information about which * WebContents is the source of the invoke request. + * + * Errors thrown through `handle` in the main process are not transparent as they + * are serialized and only the `message` property from the original error is + * provided to the renderer process. Please refer to #24427 for details. */ handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise) | (any)): void; /** @@ -5411,8 +5336,11 @@ Retrieves the product descriptions. * Also on Windows and Linux, you can use a `&` in the top-level item name to * indicate which letter should get a generated accelerator. For example, using * `&File` for the file menu would result in a generated `Alt-F` accelerator that - * opens the associated menu. The indicated character in the button label gets an - * underline. The `&` character is not displayed on the button label. + * opens the associated menu. The indicated character in the button label then gets + * an underline, and the `&` character is not displayed on the button label. + * + * In order to escape the `&` character in an item name, add a proceeding `&`. For + * example, `&&File` would result in `&File` displayed on the button label. * * Passing `null` will suppress the default menu. On Windows and Linux, this has * the additional effect of removing the menu bar from the window. @@ -6789,6 +6717,8 @@ e.g. getAllDisplays(): Display[]; /** * The current absolute position of the mouse pointer. + * +**Note:** The return value is a DIP point, not a screen physical point. */ getCursorScreenPoint(): Point; /** @@ -6937,6 +6867,31 @@ e.g. * Information about the console message */ messageDetails: MessageDetails) => void): this; + /** + * Emitted when a service worker has been registered. Can occur after a call to + * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a + * Chrome extension is loaded. + */ + on(event: 'registration-completed', listener: (event: Event, + /** + * Information about the registered service worker + */ + details: RegistrationCompletedDetails) => void): this; + once(event: 'registration-completed', listener: (event: Event, + /** + * Information about the registered service worker + */ + details: RegistrationCompletedDetails) => void): this; + addListener(event: 'registration-completed', listener: (event: Event, + /** + * Information about the registered service worker + */ + details: RegistrationCompletedDetails) => void): this; + removeListener(event: 'registration-completed', listener: (event: Event, + /** + * Information about the registered service worker + */ + details: RegistrationCompletedDetails) => void): this; /** * A ServiceWorkerInfo object where the keys are the service worker version ID and * the values are the information about that service worker. @@ -7437,16 +7392,21 @@ Clears the host resolver cache. /** * Sets the handler which can be used to respond to permission checks for the * `session`. Returning `true` will allow the permission and `false` will reject - * it. To clear the handler, call `setPermissionCheckHandler(null)`. + * it. Please note that you must also implement `setPermissionRequestHandler` to + * get complete permission handling. Most web APIs do a permission check and then + * make a permission request if the check is denied. To clear the handler, call + * `setPermissionCheckHandler(null)`. */ - setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void; + setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void; /** * Sets the handler which can be used to respond to permission requests for the * `session`. Calling `callback(true)` will allow the permission and * `callback(false)` will reject it. To clear the handler, call - * `setPermissionRequestHandler(null)`. + * `setPermissionRequestHandler(null)`. Please note that you must also implement + * `setPermissionCheckHandler` to get complete permission handling. Most web APIs + * do a permission check and then make a permission request if the check is denied. */ - setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'display-capture' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void; + setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'display-capture' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' | 'unknown', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void; /** * Adds scripts that will be executed on ALL web contents that are associated with * this session just before normal `preload` scripts run. @@ -7629,16 +7589,6 @@ Clears the host resolver cache. * Play the beep sound. */ beep(): void; - /** - * Whether the item was successfully moved to the trash or otherwise deleted. - * - * > NOTE: This method is deprecated. Use `shell.trashItem` instead. - * -Move the given file to trash and returns a boolean status for the operation. - * - * @deprecated - */ - moveItemToTrash(fullPath: string, deleteOnFail?: boolean): boolean; /** * Open the given external protocol URL in the desktop's default manner. (For * example, mailto: URLs in the user's default mail agent). @@ -10650,7 +10600,7 @@ Example usage: * * By default, an empty `options` will be regarded as: * - * Use `page-break-before: always; ` CSS style to force to print to a new page. + * Use `page-break-before: always;` CSS style to force to print to a new page. * An example of `webContents.printToPDF`: */ @@ -11081,13 +11031,6 @@ The factor must be greater than 0.0. * this limitation. */ executeJavaScript(code: string, userGesture?: boolean): Promise; - /** - * A promise that resolves with the result of the executed code or is rejected if - * execution throws or results in a rejected promise. - * -Works like `executeJavaScript` but evaluates `scripts` in an isolated context. - */ - executeJavaScriptInIsolatedWorld(worldId: number, code: string, userGesture?: boolean): Promise; /** * Send a message to the renderer process, optionally transferring ownership of * zero or more [`MessagePortMain`][] objects. @@ -12219,13 +12162,19 @@ See webContents.sendInputEvent for detailed description of `event` object. */ titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover'); /** - * Set a custom position for the traffic light buttons. Can only be used with - * `titleBarStyle` set to `hidden` + * Set a custom position for the traffic light buttons in frameless windows. */ trafficLightPosition?: Point; /** - * Shows the title in the title bar in full screen mode on macOS for all - * `titleBarStyle` options. Default is `false`. + * Whether frameless window should have rounded corners on macOS. Default is + * `true`. + */ + roundedCorners?: boolean; + /** + * Shows the title in the title bar in full screen mode on macOS for `hiddenInset` + * titleBarStyle. Default is `false`. + * + * @deprecated */ fullscreenWindowTitle?: boolean; /** @@ -12241,8 +12190,8 @@ See webContents.sendInputEvent for detailed description of `event` object. * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please * note that using `frame: false` in combination with a vibrancy value requires * that you use a non-default `titleBarStyle` as well. Also note that - * `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been - * deprecated and will be removed in an upcoming version of macOS. + * `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are + * deprecated and have been removed in macOS Catalina (10.15). */ vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page'); /** @@ -12452,9 +12401,30 @@ See webContents.sendInputEvent for detailed description of `event` object. */ selectionText: string; /** - * Title or alt text of the selection that the context was invoked on. + * Title text of the selection that the context menu was invoked on. */ titleText: string; + /** + * Alt text of the selection that the context menu was invoked on. + */ + altText: string; + /** + * Suggested filename to be used when saving file through 'Save Link As' option of + * context menu. + */ + suggestedFilename: string; + /** + * Rect representing the coordinates in the document space of the selection. + */ + selectionRect: Rectangle; + /** + * Start position of the selection text. + */ + selectionStartOffset: number; + /** + * The referrer policy of the frame on which the menu is invoked. + */ + referrerPolicy: Referrer; /** * The misspelled word under the cursor, if any. */ @@ -12473,11 +12443,16 @@ See webContents.sendInputEvent for detailed description of `event` object. * Possible values are `none`, `plainText`, `password`, `other`. */ inputFieldType: string; + /** + * If the context is editable, whether or not spellchecking is enabled. + */ + spellcheckEnabled: boolean; /** * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`, - * `touch` or `touchMenu`. + * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, + * `adjustSelection`, or `adjustSelectionReset`. */ - menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'); + menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset'); /** * The flags for the media element the context menu was invoked on. */ @@ -13828,18 +13803,24 @@ See webContents.sendInputEvent for detailed description of `event` object. } interface PermissionCheckHandlerHandlerDetails { + /** + * The origin of the frame embedding the frame that made the permission check. + * Only set for cross-origin sub frames making permission checks. + */ + embeddingOrigin?: string; /** * The security origin of the `media` check. */ - securityOrigin: string; + securityOrigin?: string; /** * The type of media access being requested, can be `video`, `audio` or `unknown` */ - mediaType: ('video' | 'audio' | 'unknown'); + mediaType?: ('video' | 'audio' | 'unknown'); /** - * The last URL the requesting frame loaded + * The last URL the requesting frame loaded. This is not provided for cross-origin + * sub frames making permission checks. */ - requestingUrl: string; + requestingUrl?: string; /** * Whether the frame making the request is the main frame */ @@ -13996,6 +13977,13 @@ See webContents.sendInputEvent for detailed description of `event` object. url: string; } + interface RegistrationCompletedDetails { + /** + * The base URL that a service worker is registered for + */ + scope: string; + } + interface RelaunchOptions { args?: string[]; execPath?: string; @@ -14560,11 +14548,21 @@ See webContents.sendInputEvent for detailed description of `event` object. interface VisibleOnAllWorkspacesOptions { /** - * Sets whether the window should be visible above fullscreen windows + * Sets whether the window should be visible above fullscreen windows. * * @platform darwin */ visibleOnFullScreen?: boolean; + /** + * Calling setVisibleOnAllWorkspaces will by default transform the process type + * between UIElementApplication and ForegroundApplication to ensure the correct + * behavior. However, this will hide the window and dock for a short time every + * time it is called. If your window is already of type UIElementApplication, you + * can bypass this transformation by passing true to skipTransformProcessType. + * + * @platform darwin + */ + skipTransformProcessType?: boolean; } interface WebContentsPrintOptions { @@ -14715,7 +14713,7 @@ See webContents.sendInputEvent for detailed description of `event` object. */ canCut: boolean; /** - * Whether the renderer believes it can copy + * Whether the renderer believes it can copy. */ canCopy: boolean; /** @@ -14730,6 +14728,10 @@ See webContents.sendInputEvent for detailed description of `event` object. * Whether the renderer believes it can select all. */ canSelectAll: boolean; + /** + * Whether the renderer believes it can edit text richly. + */ + canEditRichly: boolean; } interface FoundInPageResult { @@ -14837,10 +14839,30 @@ See webContents.sendInputEvent for detailed description of `event` object. * Whether the media element's controls are toggleable. */ canToggleControls: boolean; + /** + * Whether the media element can be printed. + */ + canPrint: boolean; + /** + * Whether or not the media element can be downloaded. + */ + canSave: boolean; + /** + * Whether the media element can show picture-in-picture. + */ + canShowPictureInPicture: boolean; + /** + * Whether the media element is currently showing picture-in-picture. + */ + isShowingPictureInPicture: boolean; /** * Whether the media element can be rotated. */ canRotate: boolean; + /** + * Whether the media element can be looped. + */ + canLoop: boolean; } interface PageRanges { @@ -15293,6 +15315,7 @@ See webContents.sendInputEvent for detailed description of `event` object. type ProgressBarOptions = Electron.ProgressBarOptions; type Provider = Electron.Provider; type ReadBookmark = Electron.ReadBookmark; + type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails; type RelaunchOptions = Electron.RelaunchOptions; type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails; type Request = Electron.Request; @@ -15551,6 +15574,7 @@ See webContents.sendInputEvent for detailed description of `event` object. type ProgressBarOptions = Electron.ProgressBarOptions; type Provider = Electron.Provider; type ReadBookmark = Electron.ReadBookmark; + type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails; type RelaunchOptions = Electron.RelaunchOptions; type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails; type Request = Electron.Request; @@ -15762,6 +15786,7 @@ See webContents.sendInputEvent for detailed description of `event` object. type ProgressBarOptions = Electron.ProgressBarOptions; type Provider = Electron.Provider; type ReadBookmark = Electron.ReadBookmark; + type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails; type RelaunchOptions = Electron.RelaunchOptions; type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails; type Request = Electron.Request; diff --git a/index.js b/index.js index 90a28d1..ccde246 100644 --- a/index.js +++ b/index.js @@ -4,11 +4,14 @@ const path = require('path'); const pathFile = path.join(__dirname, 'path.txt'); function getElectronPath () { + let executablePath; if (fs.existsSync(pathFile)) { - const executablePath = fs.readFileSync(pathFile, 'utf-8'); - if (process.env.ELECTRON_OVERRIDE_DIST_PATH) { - return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath); - } + executablePath = fs.readFileSync(pathFile, 'utf-8'); + } + if (process.env.ELECTRON_OVERRIDE_DIST_PATH) { + return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron'); + } + if (executablePath) { return path.join(__dirname, 'dist', executablePath); } else { throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again'); diff --git a/package.json b/package.json index 27792b3..fb12d64 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "node": ">= 8.6" }, "name": "electron", - "version": "12.0.0-wvvmp-beta.31", + "version": "13.0.0-wvvmp-beta.2", "repository": "https://github.com/castlabs/electron-releases", "description": "Build cross platform desktop apps with JavaScript, HTML, CSS, and Widevine DRM protection", "license": "MIT",