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.
Files changed (67) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +83 -71
  3. package/dist/base/browser/browser.d.ts +26 -26
  4. package/dist/base/browser/browser.js +3 -3
  5. package/dist/base/browser/event.d.ts +12 -12
  6. package/dist/base/browser/event.js +3 -3
  7. package/dist/base/browser/keyboardEvent.d.ts +38 -38
  8. package/dist/base/browser/keyboardEvent.js +7 -7
  9. package/dist/base/browser/mouseEvent.d.ts +61 -61
  10. package/dist/base/browser/mouseEvent.js +4 -4
  11. package/dist/base/browser/touch.d.ts +39 -0
  12. package/dist/base/browser/touch.js +454 -0
  13. package/dist/base/common/arrays.d.ts +10 -4
  14. package/dist/base/common/arrays.js +17 -6
  15. package/dist/base/common/async.d.ts +35 -35
  16. package/dist/base/common/async.js +12 -12
  17. package/dist/base/common/charCode.d.ts +405 -405
  18. package/dist/base/common/charCode.js +3 -3
  19. package/dist/base/common/color.d.ts +159 -159
  20. package/dist/base/common/color.js +38 -37
  21. package/dist/base/common/decorators.d.ts +6 -0
  22. package/dist/base/common/decorators.js +300 -0
  23. package/dist/base/common/dom.d.ts +221 -185
  24. package/dist/base/common/dom.js +191 -51
  25. package/dist/base/common/event.d.ts +213 -213
  26. package/dist/base/common/event.js +103 -103
  27. package/dist/base/common/iterator.d.ts +69 -69
  28. package/dist/base/common/iterator.js +3 -3
  29. package/dist/base/common/keyCodes.d.ts +478 -273
  30. package/dist/base/common/keyCodes.js +22 -8
  31. package/dist/base/common/lifecycle.d.ts +17 -17
  32. package/dist/base/common/lifecycle.js +4 -4
  33. package/dist/base/common/linkedList.d.ts +17 -17
  34. package/dist/base/common/linkedList.js +4 -4
  35. package/dist/base/common/platform.d.ts +33 -33
  36. package/dist/base/common/platform.js +3 -3
  37. package/dist/base/common/strings.d.ts +23 -0
  38. package/dist/base/common/strings.js +273 -0
  39. package/dist/consts.d.ts +49 -11
  40. package/dist/consts.js +107 -3
  41. package/dist/index.d.ts +3 -3
  42. package/dist/index.js +3 -3
  43. package/dist/main/attach-titlebar-to-window.d.ts +3 -3
  44. package/dist/main/attach-titlebar-to-window.js +3 -3
  45. package/dist/main/index.d.ts +3 -3
  46. package/dist/main/index.js +3 -3
  47. package/dist/main/setup-titlebar.d.ts +2 -2
  48. package/dist/main/setup-titlebar.js +13 -3
  49. package/dist/menubar/index.d.ts +86 -16
  50. package/dist/menubar/index.js +910 -28
  51. package/dist/menubar/menu/index.d.ts +46 -0
  52. package/dist/menubar/menu/index.js +556 -0
  53. package/dist/menubar/menu/item.d.ts +67 -0
  54. package/dist/menubar/menu/item.js +575 -0
  55. package/dist/menubar/menu/separator.d.ts +11 -0
  56. package/dist/menubar/menu/separator.js +213 -0
  57. package/dist/menubar/menu/submenu.d.ts +32 -0
  58. package/dist/menubar/menu/submenu.js +372 -0
  59. package/dist/menubar/menubar-options.d.ts +55 -33
  60. package/dist/menubar/menubar-options.js +3 -3
  61. package/dist/titlebar/index.d.ts +99 -88
  62. package/dist/titlebar/index.js +181 -119
  63. package/dist/titlebar/options.d.ts +84 -58
  64. package/dist/titlebar/options.js +3 -3
  65. package/dist/titlebar/themebar.d.ts +20 -20
  66. package/dist/titlebar/themebar.js +4 -4
  67. package/package.json +68 -65
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 - now 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.
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
- > ## 📢 NOTE:
6
- > ### This is a Beta version, so it may have some bugs and not all the features of the stable version
7
-
8
- [![LICENSE](https://img.shields.io/github/license/AlexTorresSk/custom-electron-titlebar.svg)](https://github.com/AlexTorresSk/custom-electron-titlebar/blob/master/LICENSE)
9
- [![NPM Version](https://img.shields.io/npm/v/custom-electron-titlebar.svg)](https://npmjs.org/package/custom-electron-titlebar)
10
- [![install size](https://packagephobia.com/badge?p=custom-electron-titlebar@4.2.0-beta.0)](https://packagephobia.com/result?p=custom-electron-titlebar@4.2.0-beta.0)
11
-
12
- Standard Title Bar
13
-
14
- ![Screenshot 1](screenshots/cet-screen-1.png)
15
-
16
- Bottom Menu Bar
17
-
18
- ![Screenshot 2](screenshots/cet-screen-2.png)
19
-
20
- # 📦 Installing
21
- You can install this package with `npm`.
22
- ```sh
23
- npm install custom-electron-titlebar
24
- ```
25
-
26
- # 🛠️ Usage
27
- The implementation is done as follows:
28
-
29
- In the main application file (main.js or .ts)
30
- ```js
31
- import { setupTitlebar, attachTitlebarToWindow } from "custom-electron-titlebar/main";
32
-
33
- // setup the titlebar main process
34
- setupTitlebar();
35
-
36
- function createWindow() {
37
- // Create the browser window.
38
- const mainWindow = new BrowserWindow({
39
- width: 800,
40
- height: 600,
41
- titleBarStyle: 'hidden',
42
- //frame: false, // needed if process.versions.electron < 14
43
- webPreferences: {
44
- sandbox: false,
45
- preload: path.join(__dirname, 'preload.js')
46
- }
47
- });
48
-
49
- ...
50
-
51
- // attach fullScreen(f11 and not 'maximized') && focus listeners
52
- attachTitlebarToWindow(mainWindow);
53
- }
54
- ```
55
-
56
- In the preload file (preload.js or .ts)
57
- ```js
58
- import { Titlebar } from "custom-electron-titlebar";
59
-
60
- window.addEventListener('DOMContentLoaded', () => {
61
- // Title bar implementation
62
- new Titlebar();
63
- });
64
- ```
65
- 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/AlexTorresSk/custom-electron-titlebar/wiki)
66
-
67
- ## 💰 Support
68
- If you want to support my development, you can do so by donating through [Buy me a coffee](https://www.buymeacoffee.com/AlexTorresSk) or [Patreon](https://www.patreon.com/AlexTorresSk)
69
-
70
- ## ✅ License
71
- This project is under the [MIT](https://github.com/AlexTorresSk/custom-electron-titlebar/blob/master/LICENSE) license.
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
+ [![LICENSE](https://img.shields.io/github/license/AlexTorresDev/custom-electron-titlebar.svg)](https://github.com/AlexTorresDev/custom-electron-titlebar/blob/master/LICENSE)
6
+ [![NPM Version](https://img.shields.io/npm/v/custom-electron-titlebar.svg)](https://npmjs.org/package/custom-electron-titlebar)
7
+ [![install size](https://packagephobia.com/badge?p=custom-electron-titlebar)](https://packagephobia.com/result?p=custom-electron-titlebar)
8
+
9
+ [📄 Visit Documentation](https://cet.alextrs.dev)
10
+
11
+ Standard Title Bar
12
+
13
+ ![Screenshot 1](screenshots/cet-1.png)
14
+
15
+ Bottom Menu Bar
16
+
17
+ ![Screenshot 2](screenshots/cet-2.png)
18
+
19
+ Menu
20
+
21
+ ![Screenshot 3](screenshots/cet-3.png)
22
+
23
+ Custom color
24
+
25
+ ![Screenshot 4](screenshots/cet-4.png)
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 'base/common/event';
2
- import { IDisposable } from 'base/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
+ 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 'base/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
+ 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 'base/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
+ 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] = -1;
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("./browser"));
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
+ }