custom-electron-titlebar 4.2.0-beta.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +83 -71
- package/dist/base/browser/browser.d.ts +26 -26
- package/dist/base/browser/browser.js +3 -3
- package/dist/base/browser/event.d.ts +12 -12
- package/dist/base/browser/event.js +3 -3
- package/dist/base/browser/keyboardEvent.d.ts +38 -38
- package/dist/base/browser/keyboardEvent.js +7 -7
- package/dist/base/browser/mouseEvent.d.ts +61 -61
- package/dist/base/browser/mouseEvent.js +4 -4
- package/dist/base/browser/touch.d.ts +39 -0
- package/dist/base/browser/touch.js +454 -0
- package/dist/base/common/arrays.d.ts +10 -4
- package/dist/base/common/arrays.js +17 -6
- package/dist/base/common/async.d.ts +35 -35
- package/dist/base/common/async.js +12 -12
- package/dist/base/common/charCode.d.ts +405 -405
- package/dist/base/common/charCode.js +3 -3
- package/dist/base/common/color.d.ts +159 -159
- package/dist/base/common/color.js +38 -37
- package/dist/base/common/decorators.d.ts +6 -0
- package/dist/base/common/decorators.js +300 -0
- package/dist/base/common/dom.d.ts +221 -185
- package/dist/base/common/dom.js +191 -51
- package/dist/base/common/event.d.ts +213 -213
- package/dist/base/common/event.js +103 -103
- package/dist/base/common/iterator.d.ts +69 -69
- package/dist/base/common/iterator.js +3 -3
- package/dist/base/common/keyCodes.d.ts +478 -273
- package/dist/base/common/keyCodes.js +22 -8
- package/dist/base/common/lifecycle.d.ts +17 -17
- package/dist/base/common/lifecycle.js +4 -4
- package/dist/base/common/linkedList.d.ts +17 -17
- package/dist/base/common/linkedList.js +4 -4
- package/dist/base/common/platform.d.ts +33 -33
- package/dist/base/common/platform.js +3 -3
- package/dist/base/common/strings.d.ts +23 -0
- package/dist/base/common/strings.js +273 -0
- package/dist/consts.d.ts +49 -11
- package/dist/consts.js +107 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/main/attach-titlebar-to-window.d.ts +3 -3
- package/dist/main/attach-titlebar-to-window.js +3 -3
- package/dist/main/index.d.ts +3 -3
- package/dist/main/index.js +3 -3
- package/dist/main/setup-titlebar.d.ts +2 -2
- package/dist/main/setup-titlebar.js +13 -3
- package/dist/menubar/index.d.ts +86 -16
- package/dist/menubar/index.js +910 -28
- package/dist/menubar/menu/index.d.ts +46 -0
- package/dist/menubar/menu/index.js +556 -0
- package/dist/menubar/menu/item.d.ts +67 -0
- package/dist/menubar/menu/item.js +575 -0
- package/dist/menubar/menu/separator.d.ts +11 -0
- package/dist/menubar/menu/separator.js +213 -0
- package/dist/menubar/menu/submenu.d.ts +32 -0
- package/dist/menubar/menu/submenu.js +372 -0
- package/dist/menubar/menubar-options.d.ts +55 -33
- package/dist/menubar/menubar-options.js +3 -3
- package/dist/titlebar/index.d.ts +99 -88
- package/dist/titlebar/index.js +181 -119
- package/dist/titlebar/options.d.ts +84 -58
- package/dist/titlebar/options.js +3 -3
- package/dist/titlebar/themebar.d.ts +20 -20
- package/dist/titlebar/themebar.js +4 -4
- package/package.json +68 -65
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Alex Torres
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,71 +1,83 @@
|
|
|
1
|
-
# Custom Electron Titlebar
|
|
2
|
-
|
|
3
|
-
This project is a typescript library for electron that allows you to configure a fully customizable title bar.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
1
|
+
# Custom Electron Titlebar
|
|
2
|
+
|
|
3
|
+
This project is a typescript library for electron that allows you to configure a fully customizable title bar.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/AlexTorresDev/custom-electron-titlebar/blob/master/LICENSE)
|
|
6
|
+
[](https://npmjs.org/package/custom-electron-titlebar)
|
|
7
|
+
[](https://packagephobia.com/result?p=custom-electron-titlebar)
|
|
8
|
+
|
|
9
|
+
[📄 Visit Documentation](https://cet.alextrs.dev)
|
|
10
|
+
|
|
11
|
+
Standard Title Bar
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
Bottom Menu Bar
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
Menu
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
Custom color
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
# 📦 Installing
|
|
28
|
+
You can install this package with `npm`.
|
|
29
|
+
```sh
|
|
30
|
+
npm install custom-electron-titlebar
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
# 🛠️ Usage
|
|
34
|
+
The implementation is done as follows:
|
|
35
|
+
|
|
36
|
+
In the main application file (main.js or .ts)
|
|
37
|
+
```js
|
|
38
|
+
import { setupTitlebar, attachTitlebarToWindow } from "custom-electron-titlebar/main";
|
|
39
|
+
|
|
40
|
+
// setup the titlebar main process
|
|
41
|
+
setupTitlebar();
|
|
42
|
+
|
|
43
|
+
function createWindow() {
|
|
44
|
+
// Create the browser window.
|
|
45
|
+
const mainWindow = new BrowserWindow({
|
|
46
|
+
width: 800,
|
|
47
|
+
height: 600,
|
|
48
|
+
titleBarStyle: 'hidden',
|
|
49
|
+
//frame: false, // needed if process.versions.electron < 14
|
|
50
|
+
webPreferences: {
|
|
51
|
+
sandbox: false,
|
|
52
|
+
preload: path.join(__dirname, 'preload.js')
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
// attach fullScreen(f11 and not 'maximized') && focus listeners
|
|
59
|
+
attachTitlebarToWindow(mainWindow);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
In the preload file (preload.js or .ts)
|
|
64
|
+
```js
|
|
65
|
+
import { Titlebar } from "custom-electron-titlebar";
|
|
66
|
+
|
|
67
|
+
window.addEventListener('DOMContentLoaded', () => {
|
|
68
|
+
// Title bar implementation
|
|
69
|
+
new Titlebar();
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
To see the options you can include in the Title Bar constructor, such as color of elements, icons, menu position, and much more, and the methods you can use, go to the [wiki](https://github.com/AlexTorresDev/custom-electron-titlebar/wiki)
|
|
73
|
+
|
|
74
|
+
## 💰 Support
|
|
75
|
+
If you want to support my development, you can do so by donating through [Buy me a coffee](https://www.buymeacoffee.com/AlexTorresDev)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 📝 Collaborators
|
|
79
|
+
I would like to express my sincere gratitude to all the people who have collaborated in the development and advancement of this project. I appreciate your contributions.
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## ✅ License
|
|
83
|
+
This project is under the [MIT](https://github.com/AlexTorresDev/custom-electron-titlebar/blob/master/LICENSE) license.
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Event } from '
|
|
2
|
-
import { IDisposable } from '
|
|
3
|
-
/** A zoom index, e.g. 1, 2, 3 */
|
|
4
|
-
export declare function setZoomLevel(zoomLevel: number, isTrusted: boolean): void;
|
|
5
|
-
export declare function getZoomLevel(): number;
|
|
6
|
-
/** Returns the time (in ms) since the zoom level was changed */
|
|
7
|
-
export declare function getTimeSinceLastZoomLevelChanged(): number;
|
|
8
|
-
export declare function onDidChangeZoomLevel(callback: (zoomLevel: number) => void): IDisposable;
|
|
9
|
-
/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */
|
|
10
|
-
export declare function getZoomFactor(): number;
|
|
11
|
-
export declare function setZoomFactor(zoomFactor: number): void;
|
|
12
|
-
export declare function getPixelRatio(): number;
|
|
13
|
-
export declare function setFullscreen(fullscreen: boolean): void;
|
|
14
|
-
export declare function isFullscreen(): boolean;
|
|
15
|
-
export declare const onDidChangeFullscreen: Event<void>;
|
|
16
|
-
export declare const isIE: boolean;
|
|
17
|
-
export declare const isEdge: boolean;
|
|
18
|
-
export declare const isEdgeOrIE: boolean;
|
|
19
|
-
export declare const isOpera: boolean;
|
|
20
|
-
export declare const isFirefox: boolean;
|
|
21
|
-
export declare const isWebKit: boolean;
|
|
22
|
-
export declare const isChrome: boolean;
|
|
23
|
-
export declare const isSafari: boolean;
|
|
24
|
-
export declare const isWebkitWebView: boolean;
|
|
25
|
-
export declare const isIPad: boolean;
|
|
26
|
-
export declare const isEdgeWebView: boolean;
|
|
1
|
+
import { Event } from '../common/event';
|
|
2
|
+
import { IDisposable } from '../common/lifecycle';
|
|
3
|
+
/** A zoom index, e.g. 1, 2, 3 */
|
|
4
|
+
export declare function setZoomLevel(zoomLevel: number, isTrusted: boolean): void;
|
|
5
|
+
export declare function getZoomLevel(): number;
|
|
6
|
+
/** Returns the time (in ms) since the zoom level was changed */
|
|
7
|
+
export declare function getTimeSinceLastZoomLevelChanged(): number;
|
|
8
|
+
export declare function onDidChangeZoomLevel(callback: (zoomLevel: number) => void): IDisposable;
|
|
9
|
+
/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */
|
|
10
|
+
export declare function getZoomFactor(): number;
|
|
11
|
+
export declare function setZoomFactor(zoomFactor: number): void;
|
|
12
|
+
export declare function getPixelRatio(): number;
|
|
13
|
+
export declare function setFullscreen(fullscreen: boolean): void;
|
|
14
|
+
export declare function isFullscreen(): boolean;
|
|
15
|
+
export declare const onDidChangeFullscreen: Event<void>;
|
|
16
|
+
export declare const isIE: boolean;
|
|
17
|
+
export declare const isEdge: boolean;
|
|
18
|
+
export declare const isEdgeOrIE: boolean;
|
|
19
|
+
export declare const isOpera: boolean;
|
|
20
|
+
export declare const isFirefox: boolean;
|
|
21
|
+
export declare const isWebKit: boolean;
|
|
22
|
+
export declare const isChrome: boolean;
|
|
23
|
+
export declare const isSafari: boolean;
|
|
24
|
+
export declare const isWebkitWebView: boolean;
|
|
25
|
+
export declare const isIPad: boolean;
|
|
26
|
+
export declare const isEdgeWebView: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/* ---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
3
|
+
/* ---------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
6
|
*-------------------------------------------------------------------------------------------- */
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Event } from '
|
|
2
|
-
export type EventHandler = HTMLElement | HTMLDocument | Window;
|
|
3
|
-
export interface IDomEvent {
|
|
4
|
-
<K extends keyof HTMLElementEventMap>(element: EventHandler, type: K, useCapture?: boolean): Event<HTMLElementEventMap[K]>;
|
|
5
|
-
(element: EventHandler, type: string, useCapture?: boolean): Event<any>;
|
|
6
|
-
}
|
|
7
|
-
export declare const domEvent: IDomEvent;
|
|
8
|
-
export interface CancellableEvent {
|
|
9
|
-
preventDefault(): any;
|
|
10
|
-
stopPropagation(): any;
|
|
11
|
-
}
|
|
12
|
-
export declare function stop<T extends CancellableEvent>(event: Event<T>): Event<T>;
|
|
1
|
+
import { Event } from '../common/event';
|
|
2
|
+
export type EventHandler = HTMLElement | HTMLDocument | Window;
|
|
3
|
+
export interface IDomEvent {
|
|
4
|
+
<K extends keyof HTMLElementEventMap>(element: EventHandler, type: K, useCapture?: boolean): Event<HTMLElementEventMap[K]>;
|
|
5
|
+
(element: EventHandler, type: string, useCapture?: boolean): Event<any>;
|
|
6
|
+
}
|
|
7
|
+
export declare const domEvent: IDomEvent;
|
|
8
|
+
export interface CancellableEvent {
|
|
9
|
+
preventDefault(): any;
|
|
10
|
+
stopPropagation(): any;
|
|
11
|
+
}
|
|
12
|
+
export declare function stop<T extends CancellableEvent>(event: Event<T>): Event<T>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/* ---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
3
|
+
/* ---------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
6
|
*-------------------------------------------------------------------------------------------- */
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { KeyCode, SimpleKeybinding } from '
|
|
2
|
-
export declare function getCodeForKeyCode(keyCode: KeyCode): number;
|
|
3
|
-
export interface IKeyboardEvent {
|
|
4
|
-
readonly browserEvent: KeyboardEvent;
|
|
5
|
-
readonly target: HTMLElement;
|
|
6
|
-
readonly ctrlKey: boolean;
|
|
7
|
-
readonly shiftKey: boolean;
|
|
8
|
-
readonly altKey: boolean;
|
|
9
|
-
readonly metaKey: boolean;
|
|
10
|
-
readonly keyCode: KeyCode;
|
|
11
|
-
readonly code: string;
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
toKeybinding(): SimpleKeybinding;
|
|
16
|
-
equals(keybinding: number): boolean;
|
|
17
|
-
preventDefault(): void;
|
|
18
|
-
stopPropagation(): void;
|
|
19
|
-
}
|
|
20
|
-
export declare class StandardKeyboardEvent implements IKeyboardEvent {
|
|
21
|
-
readonly browserEvent: KeyboardEvent;
|
|
22
|
-
readonly target: HTMLElement;
|
|
23
|
-
readonly ctrlKey: boolean;
|
|
24
|
-
readonly shiftKey: boolean;
|
|
25
|
-
readonly altKey: boolean;
|
|
26
|
-
readonly metaKey: boolean;
|
|
27
|
-
readonly keyCode: KeyCode;
|
|
28
|
-
readonly code: string;
|
|
29
|
-
private _asKeybinding;
|
|
30
|
-
private _asRuntimeKeybinding;
|
|
31
|
-
constructor(source: KeyboardEvent);
|
|
32
|
-
preventDefault(): void;
|
|
33
|
-
stopPropagation(): void;
|
|
34
|
-
toKeybinding(): SimpleKeybinding;
|
|
35
|
-
equals(other: number): boolean;
|
|
36
|
-
private _computeKeybinding;
|
|
37
|
-
private _computeRuntimeKeybinding;
|
|
38
|
-
}
|
|
1
|
+
import { KeyCode, SimpleKeybinding } from '../common/keyCodes';
|
|
2
|
+
export declare function getCodeForKeyCode(keyCode: KeyCode): number;
|
|
3
|
+
export interface IKeyboardEvent {
|
|
4
|
+
readonly browserEvent: KeyboardEvent;
|
|
5
|
+
readonly target: HTMLElement;
|
|
6
|
+
readonly ctrlKey: boolean;
|
|
7
|
+
readonly shiftKey: boolean;
|
|
8
|
+
readonly altKey: boolean;
|
|
9
|
+
readonly metaKey: boolean;
|
|
10
|
+
readonly keyCode: KeyCode;
|
|
11
|
+
readonly code: string;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
toKeybinding(): SimpleKeybinding;
|
|
16
|
+
equals(keybinding: number): boolean;
|
|
17
|
+
preventDefault(): void;
|
|
18
|
+
stopPropagation(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare class StandardKeyboardEvent implements IKeyboardEvent {
|
|
21
|
+
readonly browserEvent: KeyboardEvent;
|
|
22
|
+
readonly target: HTMLElement;
|
|
23
|
+
readonly ctrlKey: boolean;
|
|
24
|
+
readonly shiftKey: boolean;
|
|
25
|
+
readonly altKey: boolean;
|
|
26
|
+
readonly metaKey: boolean;
|
|
27
|
+
readonly keyCode: KeyCode;
|
|
28
|
+
readonly code: string;
|
|
29
|
+
private _asKeybinding;
|
|
30
|
+
private _asRuntimeKeybinding;
|
|
31
|
+
constructor(source: KeyboardEvent);
|
|
32
|
+
preventDefault(): void;
|
|
33
|
+
stopPropagation(): void;
|
|
34
|
+
toKeybinding(): SimpleKeybinding;
|
|
35
|
+
equals(other: number): boolean;
|
|
36
|
+
private _computeKeybinding;
|
|
37
|
+
private _computeRuntimeKeybinding;
|
|
38
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/* ---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
3
|
+
/* ---------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
6
|
*-------------------------------------------------------------------------------------------- */
|
|
7
7
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
8
8
|
if (k2 === undefined) k2 = k;
|
|
@@ -45,7 +45,7 @@ const KEY_CODE_MAP = new Array(230);
|
|
|
45
45
|
const INVERSE_KEY_CODE_MAP = new Array(112 /* KeyCode.MAX_VALUE */);
|
|
46
46
|
(function () {
|
|
47
47
|
for (let i = 0; i < _get__("INVERSE_KEY_CODE_MAP").length; i++) {
|
|
48
|
-
_get__("INVERSE_KEY_CODE_MAP")[i] =
|
|
48
|
+
_get__("INVERSE_KEY_CODE_MAP")[i] = 0;
|
|
49
49
|
}
|
|
50
50
|
function define(code, keyCode) {
|
|
51
51
|
_get__("KEY_CODE_MAP")[code] = keyCode;
|
|
@@ -161,9 +161,9 @@ const INVERSE_KEY_CODE_MAP = new Array(112 /* KeyCode.MAX_VALUE */);
|
|
|
161
161
|
define(222, 90 /* KeyCode.US_QUOTE */);
|
|
162
162
|
define(223, 91 /* KeyCode.OEM_8 */);
|
|
163
163
|
define(226, 92 /* KeyCode.OEM_102 */);
|
|
164
|
-
/**
|
|
165
|
-
* https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
|
|
166
|
-
* If an Input Method Editor is processing key input and the event is keydown, return 229.
|
|
164
|
+
/**
|
|
165
|
+
* https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
|
|
166
|
+
* If an Input Method Editor is processing key input and the event is keydown, return 229.
|
|
167
167
|
*/
|
|
168
168
|
define(229, 109 /* KeyCode.KEY_IN_COMPOSITION */);
|
|
169
169
|
define(91, 57 /* KeyCode.Meta */);
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
export interface IMouseEvent {
|
|
2
|
-
readonly browserEvent: MouseEvent;
|
|
3
|
-
readonly leftButton: boolean;
|
|
4
|
-
readonly middleButton: boolean;
|
|
5
|
-
readonly rightButton: boolean;
|
|
6
|
-
readonly target: HTMLElement;
|
|
7
|
-
readonly detail: number;
|
|
8
|
-
readonly posx: number;
|
|
9
|
-
readonly posy: number;
|
|
10
|
-
readonly ctrlKey: boolean;
|
|
11
|
-
readonly shiftKey: boolean;
|
|
12
|
-
readonly altKey: boolean;
|
|
13
|
-
readonly metaKey: boolean;
|
|
14
|
-
readonly timestamp: number;
|
|
15
|
-
preventDefault(): void;
|
|
16
|
-
stopPropagation(): void;
|
|
17
|
-
}
|
|
18
|
-
export declare class StandardMouseEvent implements IMouseEvent {
|
|
19
|
-
readonly browserEvent: MouseEvent;
|
|
20
|
-
readonly leftButton: boolean;
|
|
21
|
-
readonly middleButton: boolean;
|
|
22
|
-
readonly rightButton: boolean;
|
|
23
|
-
readonly target: HTMLElement;
|
|
24
|
-
detail: number;
|
|
25
|
-
readonly posx: number;
|
|
26
|
-
readonly posy: number;
|
|
27
|
-
readonly ctrlKey: boolean;
|
|
28
|
-
readonly shiftKey: boolean;
|
|
29
|
-
readonly altKey: boolean;
|
|
30
|
-
readonly metaKey: boolean;
|
|
31
|
-
readonly timestamp: number;
|
|
32
|
-
constructor(e: MouseEvent);
|
|
33
|
-
preventDefault(): void;
|
|
34
|
-
stopPropagation(): void;
|
|
35
|
-
}
|
|
36
|
-
export interface IDataTransfer {
|
|
37
|
-
dropEffect: string;
|
|
38
|
-
effectAllowed: string;
|
|
39
|
-
types: any[];
|
|
40
|
-
files: any[];
|
|
41
|
-
setData(type: string, data: string): void;
|
|
42
|
-
setDragImage(image: any, x: number, y: number): void;
|
|
43
|
-
getData(type: string): string;
|
|
44
|
-
clearData(types?: string[]): void;
|
|
45
|
-
}
|
|
46
|
-
export declare class DragMouseEvent extends StandardMouseEvent {
|
|
47
|
-
readonly dataTransfer: IDataTransfer;
|
|
48
|
-
constructor(e: MouseEvent);
|
|
49
|
-
}
|
|
50
|
-
export interface IMouseWheelEvent extends MouseEvent {
|
|
51
|
-
readonly wheelDelta: number;
|
|
52
|
-
}
|
|
53
|
-
export declare class StandardWheelEvent {
|
|
54
|
-
readonly browserEvent: IMouseWheelEvent | null;
|
|
55
|
-
readonly deltaY: number;
|
|
56
|
-
readonly deltaX: number;
|
|
57
|
-
readonly target: Node;
|
|
58
|
-
constructor(e: IMouseWheelEvent | null, deltaX?: number, deltaY?: number);
|
|
59
|
-
preventDefault(): void;
|
|
60
|
-
stopPropagation(): void;
|
|
61
|
-
}
|
|
1
|
+
export interface IMouseEvent {
|
|
2
|
+
readonly browserEvent: MouseEvent;
|
|
3
|
+
readonly leftButton: boolean;
|
|
4
|
+
readonly middleButton: boolean;
|
|
5
|
+
readonly rightButton: boolean;
|
|
6
|
+
readonly target: HTMLElement;
|
|
7
|
+
readonly detail: number;
|
|
8
|
+
readonly posx: number;
|
|
9
|
+
readonly posy: number;
|
|
10
|
+
readonly ctrlKey: boolean;
|
|
11
|
+
readonly shiftKey: boolean;
|
|
12
|
+
readonly altKey: boolean;
|
|
13
|
+
readonly metaKey: boolean;
|
|
14
|
+
readonly timestamp: number;
|
|
15
|
+
preventDefault(): void;
|
|
16
|
+
stopPropagation(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class StandardMouseEvent implements IMouseEvent {
|
|
19
|
+
readonly browserEvent: MouseEvent;
|
|
20
|
+
readonly leftButton: boolean;
|
|
21
|
+
readonly middleButton: boolean;
|
|
22
|
+
readonly rightButton: boolean;
|
|
23
|
+
readonly target: HTMLElement;
|
|
24
|
+
detail: number;
|
|
25
|
+
readonly posx: number;
|
|
26
|
+
readonly posy: number;
|
|
27
|
+
readonly ctrlKey: boolean;
|
|
28
|
+
readonly shiftKey: boolean;
|
|
29
|
+
readonly altKey: boolean;
|
|
30
|
+
readonly metaKey: boolean;
|
|
31
|
+
readonly timestamp: number;
|
|
32
|
+
constructor(e: MouseEvent);
|
|
33
|
+
preventDefault(): void;
|
|
34
|
+
stopPropagation(): void;
|
|
35
|
+
}
|
|
36
|
+
export interface IDataTransfer {
|
|
37
|
+
dropEffect: string;
|
|
38
|
+
effectAllowed: string;
|
|
39
|
+
types: any[];
|
|
40
|
+
files: any[];
|
|
41
|
+
setData(type: string, data: string): void;
|
|
42
|
+
setDragImage(image: any, x: number, y: number): void;
|
|
43
|
+
getData(type: string): string;
|
|
44
|
+
clearData(types?: string[]): void;
|
|
45
|
+
}
|
|
46
|
+
export declare class DragMouseEvent extends StandardMouseEvent {
|
|
47
|
+
readonly dataTransfer: IDataTransfer;
|
|
48
|
+
constructor(e: MouseEvent);
|
|
49
|
+
}
|
|
50
|
+
export interface IMouseWheelEvent extends MouseEvent {
|
|
51
|
+
readonly wheelDelta: number;
|
|
52
|
+
}
|
|
53
|
+
export declare class StandardWheelEvent {
|
|
54
|
+
readonly browserEvent: IMouseWheelEvent | null;
|
|
55
|
+
readonly deltaY: number;
|
|
56
|
+
readonly deltaX: number;
|
|
57
|
+
readonly target: Node;
|
|
58
|
+
constructor(e: IMouseWheelEvent | null, deltaX?: number, deltaY?: number);
|
|
59
|
+
preventDefault(): void;
|
|
60
|
+
stopPropagation(): void;
|
|
61
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/* ---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
3
|
+
/* ---------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
6
|
*-------------------------------------------------------------------------------------------- */
|
|
7
7
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
8
8
|
if (k2 === undefined) k2 = k;
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
39
39
|
value: true
|
|
40
40
|
});
|
|
41
41
|
exports.StandardWheelEvent = exports.DragMouseEvent = exports.StandardMouseEvent = void 0;
|
|
42
|
-
const browser = _get__("__importStar")(require("
|
|
42
|
+
const browser = _get__("__importStar")(require("../browser/browser"));
|
|
43
43
|
const platform = _get__("__importStar")(require("../common/platform"));
|
|
44
44
|
class StandardMouseEvent {
|
|
45
45
|
constructor(e) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Disposable, IDisposable } from '../common/lifecycle';
|
|
2
|
+
export declare namespace EventType {
|
|
3
|
+
const Tap = "-monaco-gesturetap";
|
|
4
|
+
const Change = "-monaco-gesturechange";
|
|
5
|
+
const Start = "-monaco-gesturestart";
|
|
6
|
+
const End = "-monaco-gesturesend";
|
|
7
|
+
const Contextmenu = "-monaco-gesturecontextmenu";
|
|
8
|
+
}
|
|
9
|
+
export interface GestureEvent extends MouseEvent {
|
|
10
|
+
initialTarget: EventTarget | undefined;
|
|
11
|
+
translationX: number;
|
|
12
|
+
translationY: number;
|
|
13
|
+
pageX: number;
|
|
14
|
+
pageY: number;
|
|
15
|
+
tapCount: number;
|
|
16
|
+
}
|
|
17
|
+
export declare class Gesture extends Disposable {
|
|
18
|
+
private static readonly SCROLL_FRICTION;
|
|
19
|
+
private static INSTANCE;
|
|
20
|
+
private static readonly HOLD_DELAY;
|
|
21
|
+
private dispatched;
|
|
22
|
+
private readonly targets;
|
|
23
|
+
private readonly ignoreTargets;
|
|
24
|
+
private handle;
|
|
25
|
+
private readonly activeTouches;
|
|
26
|
+
private _lastSetTapCountTime;
|
|
27
|
+
private static readonly CLEAR_TAP_COUNT_TIME;
|
|
28
|
+
private constructor();
|
|
29
|
+
static addTarget(element: HTMLElement): IDisposable;
|
|
30
|
+
static ignoreTarget(element: HTMLElement): IDisposable;
|
|
31
|
+
static isTouchDevice(): boolean;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
private onTouchStart;
|
|
34
|
+
private onTouchEnd;
|
|
35
|
+
private newGestureEvent;
|
|
36
|
+
private dispatchEvent;
|
|
37
|
+
private inertia;
|
|
38
|
+
private onTouchMove;
|
|
39
|
+
}
|