custom-electron-titlebar 4.2.0-alpha.2 → 4.2.0

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 (63) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +83 -65
  3. package/package.json +69 -58
  4. package/dist/enums/menu-state.d.ts +0 -6
  5. package/dist/index.d.ts +0 -3
  6. package/dist/index.js +0 -1
  7. package/dist/titlebar.d.ts +0 -143
  8. package/dist/types/menubar-options.d.ts +0 -41
  9. package/dist/types/scss.d.ts +0 -6
  10. package/dist/types/titlebar-options.d.ts +0 -66
  11. package/dist/utils/color.d.ts +0 -2
  12. package/dist/vs/base/browser/browser.d.ts +0 -40
  13. package/dist/vs/base/browser/canIUse.d.ts +0 -17
  14. package/dist/vs/base/browser/dom.d.ts +0 -325
  15. package/dist/vs/base/browser/event.d.ts +0 -27
  16. package/dist/vs/base/browser/fastDomNode.d.ts +0 -59
  17. package/dist/vs/base/browser/globalMouseMoveMonitor.d.ts +0 -29
  18. package/dist/vs/base/browser/iframe.d.ts +0 -33
  19. package/dist/vs/base/browser/keyboardEvent.d.ts +0 -42
  20. package/dist/vs/base/browser/mouseEvent.d.ts +0 -69
  21. package/dist/vs/base/browser/touch.d.ts +0 -39
  22. package/dist/vs/base/browser/ui/actionbar/actionViewItems.d.ts +0 -58
  23. package/dist/vs/base/browser/ui/actionbar/actionbar.d.ts +0 -95
  24. package/dist/vs/base/browser/ui/contextview/contextview.d.ts +0 -94
  25. package/dist/vs/base/browser/ui/menu/menu.d.ts +0 -58
  26. package/dist/vs/base/browser/ui/menu/menubar.d.ts +0 -78
  27. package/dist/vs/base/browser/ui/scrollbar/abstractScrollbar.d.ts +0 -67
  28. package/dist/vs/base/browser/ui/scrollbar/horizontalScrollbar.d.ts +0 -15
  29. package/dist/vs/base/browser/ui/scrollbar/scrollableElement.d.ts +0 -107
  30. package/dist/vs/base/browser/ui/scrollbar/scrollableElementOptions.d.ts +0 -157
  31. package/dist/vs/base/browser/ui/scrollbar/scrollbarArrow.d.ts +0 -25
  32. package/dist/vs/base/browser/ui/scrollbar/scrollbarState.d.ts +0 -75
  33. package/dist/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.d.ts +0 -24
  34. package/dist/vs/base/browser/ui/scrollbar/verticalScrollbar.d.ts +0 -15
  35. package/dist/vs/base/browser/ui/widget.d.ts +0 -16
  36. package/dist/vs/base/common/actions.d.ts +0 -115
  37. package/dist/vs/base/common/arrays.d.ts +0 -168
  38. package/dist/vs/base/common/async.d.ts +0 -510
  39. package/dist/vs/base/common/cache.d.ts +0 -23
  40. package/dist/vs/base/common/cancellation.d.ts +0 -29
  41. package/dist/vs/base/common/charCode.d.ts +0 -405
  42. package/dist/vs/base/common/color.d.ts +0 -159
  43. package/dist/vs/base/common/decorators.d.ts +0 -7
  44. package/dist/vs/base/common/errors.d.ts +0 -77
  45. package/dist/vs/base/common/event.d.ts +0 -274
  46. package/dist/vs/base/common/functional.d.ts +0 -1
  47. package/dist/vs/base/common/iterator.d.ts +0 -31
  48. package/dist/vs/base/common/keyCodes.d.ts +0 -429
  49. package/dist/vs/base/common/keybindings.d.ts +0 -99
  50. package/dist/vs/base/common/lazy.d.ts +0 -19
  51. package/dist/vs/base/common/lifecycle.d.ts +0 -129
  52. package/dist/vs/base/common/linkedList.d.ts +0 -15
  53. package/dist/vs/base/common/platform.d.ts +0 -85
  54. package/dist/vs/base/common/range.d.ts +0 -18
  55. package/dist/vs/base/common/scrollable.d.ts +0 -141
  56. package/dist/vs/base/common/strings.d.ts +0 -215
  57. package/dist/vs/base/common/types.d.ts +0 -89
  58. package/dist/vs/base/common/uint.d.ts +0 -31
  59. package/dist/vs/nls.d.ts +0 -18
  60. package/main/attach-titlebar-to-window.d.ts +0 -3
  61. package/main/index.d.ts +0 -5
  62. package/main/main.js +0 -1
  63. package/main/setup-main.d.ts +0 -2
@@ -1,143 +0,0 @@
1
- import { Menu } from 'electron';
2
- import { Color } from 'vs/base/common/color';
3
- import { Dimension } from 'vs/base/browser/dom';
4
- import { TitlebarOptions } from './types/titlebar-options';
5
- import { MenuBar } from 'vs/base/browser/ui/menu/menubar';
6
- import { Disposable } from 'vs/base/common/lifecycle';
7
- import { Event } from 'vs/base/common/event';
8
- import { RunOnceScheduler } from 'vs/base/common/async';
9
- export declare class Titlebar extends Disposable {
10
- _titlebar: HTMLElement;
11
- _dragRegion: HTMLElement;
12
- _windowIcon: HTMLImageElement;
13
- _title: HTMLElement;
14
- _menubarContainer: HTMLElement;
15
- _windowControls: HTMLElement;
16
- _container: HTMLElement;
17
- _isInactive?: boolean;
18
- _menubar?: MenuBar;
19
- _options: TitlebarOptions;
20
- _windowControlIcons: {
21
- minimize: HTMLElement;
22
- maximize: HTMLElement;
23
- close: HTMLElement;
24
- };
25
- _resizer: {
26
- top: HTMLElement;
27
- left: HTMLElement;
28
- };
29
- _currentMenu: Menu | undefined;
30
- _defaultOptions: TitlebarOptions;
31
- _platformIcons: {
32
- [key: string]: string;
33
- };
34
- private reinstallDisposables;
35
- private readonly _onVisibilityChange;
36
- private readonly _onFocusStateChange;
37
- protected menuUpdater: RunOnceScheduler;
38
- constructor(titlebarOptions?: TitlebarOptions);
39
- /**
40
- * Load the icons for the window controls
41
- */
42
- _loadIcons(): void;
43
- /**
44
- * Load the background color for the titlebar
45
- */
46
- _loadBackgroundColor(): void;
47
- /**
48
- * Setup the container for the titlebar
49
- */
50
- _setupTitlebar(): void;
51
- /**
52
- * Setup the container after the titlebar
53
- */
54
- _setupContainer(): void;
55
- /**
56
- * Load events for the titlebar
57
- */
58
- _loadEvents(): void;
59
- _closeMenu: () => void;
60
- _setupIcon(): void;
61
- _setupMenubar(): void;
62
- _setupTitle(): void;
63
- _setIconSize(size?: number): void;
64
- _createControl(control: HTMLElement, enabled: boolean | undefined, title: string, icon: string, className: string): void;
65
- _createControls(): void;
66
- _onBlur(): void;
67
- _onFocus(): void;
68
- _onMenubarVisibilityChanged(visible: boolean): void;
69
- _onMenubarFocusChanged(focused: boolean): void;
70
- _onDidChangeMaximized(isMaximized: boolean): void;
71
- _updateStyles(): void;
72
- protected doUpdateMenubar(firstTime: boolean): void;
73
- /**
74
- * Update the default menu or set a new menu.
75
- * @param menu The menu.
76
- * @param firstTime If it is the first time to set the menu.
77
- */
78
- private updateMenu;
79
- private getMenuBarOptions;
80
- private updateMenubar;
81
- private onDidVisibilityChange;
82
- /**
83
- * Update title bar styles based on focus state.
84
- * @param focus focus state of the window
85
- */
86
- onWindowFocus(focus: boolean): void;
87
- /**
88
- * Update the full screen state and hide or show the title bar.
89
- * @param fullscreen Fullscreen state of the window
90
- */
91
- onWindowFullScreen(fullscreen: boolean): void;
92
- /**
93
- * Update the background color of the title bar
94
- * @param backgroundColor The color for the background
95
- */
96
- updateBackground(backgroundColor: Color): Titlebar;
97
- /**
98
- * Update the item background color of the menubar
99
- * @param itemBGColor The color for the item background
100
- */
101
- updateItemBGColor(itemBGColor: Color): Titlebar;
102
- /**
103
- * Update the title of the title bar.
104
- * You can use this method if change the content of `<title>` tag on your html.
105
- * @param title The title of the title bar and document.
106
- */
107
- updateTitle(title: string): void;
108
- /**
109
- * It method set new icon to title-bar-icon of title-bar.
110
- * @param path path to icon
111
- */
112
- updateIcon(path?: string): void;
113
- /**
114
- * Update the menu from Menu.getApplicationMenu()
115
- */
116
- refreshMenu(): Promise<void>;
117
- /**
118
- * Update the position of menubar.
119
- * @param menuPosition The position of the menu `left`, `right` or `bottom`.
120
- */
121
- updateMenuPosition(menuPosition: "left" | "right" | "bottom"): Titlebar;
122
- /**
123
- * Horizontal alignment of the title.
124
- * @param side `left`, `center` or `right`.
125
- */
126
- updateTitleAlignment(side: "left" | "center" | "right"): Titlebar;
127
- protected adjustTitleMarginToCenter(): void;
128
- /**
129
- * Remove the titlebar, menubar and all methods.
130
- */
131
- dispose(): void;
132
- get onVisibilityChange(): Event<boolean>;
133
- get onFocusStateChange(): Event<boolean>;
134
- registerListeners(): void;
135
- getMenubarItemsDimensions(): Dimension;
136
- }
137
- /**
138
- * Handles mnemonics for menu items. Depending on OS:
139
- * - Windows: Supported via & character (replace && with &)
140
- * - Linux: Supported via & character (replace && with &)
141
- * - macOS: Unsupported (replace && with empty string)
142
- */
143
- export declare function mnemonicMenuLabel(label: string, forceDisableMnemonics?: boolean): string;
@@ -1,41 +0,0 @@
1
- import { Color } from "../vs/base/common/color";
2
- export interface MenubarOptions {
3
- /**
4
- * @deprecated Use `showMenu` instead.
5
- *
6
- * The menu to show in the title bar.
7
- * You can use `Menu` or not add this option and the menu created in the main process will be taken.
8
- * **The default menu is undefined**
9
- */
10
- menu?: Electron.Menu | null;
11
- /**
12
- * The menu to show in the title bar.
13
- * **The default menu is true**
14
- */
15
- showMenu?: boolean;
16
- /**
17
- * The position of menubar on titlebar.
18
- * **The default is left**
19
- */
20
- menuPosition?: "left" | "right" | "bottom";
21
- /**
22
- * Enable the mnemonics on menubar and menu items
23
- * **The default is true**
24
- */
25
- enableMnemonics?: boolean;
26
- /**
27
- * The background color when the mouse is over the item.
28
- * **The default is undefined**
29
- */
30
- itemBackgroundColor?: Color;
31
- /**
32
- * The menu container transparency
33
- * **The default is 100**
34
- */
35
- menuTransparency?: number;
36
- /**
37
- * The color of the svg icons in the menu
38
- * **The default is black**
39
- */
40
- svgColor?: Color;
41
- }
@@ -1,6 +0,0 @@
1
- declare module "*.scss" {
2
- const styles: {
3
- [className: string]: string;
4
- };
5
- export default styles;
6
- }
@@ -1,66 +0,0 @@
1
- import { NativeImage } from "electron";
2
- import { Color } from "../vs/base/common/color";
3
- import { MenubarOptions } from "./menubar-options";
4
- export interface TitlebarOptions extends MenubarOptions {
5
- /**
6
- * The background color of titlebar.
7
- * **The default is `#ffffff`**
8
- */
9
- backgroundColor?: Color;
10
- /**
11
- * The icon shown on the left side of titlebar.
12
- * **The default is the favicon of the index.html**
13
- */
14
- icon?: NativeImage | string;
15
- /**
16
- * The icon size of titlebar. Value between 16 and 24.
17
- * **The default is 16**
18
- */
19
- iconSize?: number;
20
- /**
21
- * Define if the icon is shown on the left side of titlebar.
22
- */
23
- showIcon?: boolean;
24
- /**
25
- * The path of the icons of titlebar.
26
- */
27
- icons?: string;
28
- /**
29
- * The shadow color of titlebar.
30
- */
31
- shadow?: boolean;
32
- /**
33
- * Define if the minimize button is enabled.
34
- * **The default is true**
35
- */
36
- minimizable?: boolean;
37
- /**
38
- * Define if the maximize and restore buttons are enabled.
39
- * **The default is true**
40
- */
41
- maximizable?: boolean;
42
- /**
43
- * Define if the close button is enabled.
44
- * **The default is true**
45
- */
46
- closeable?: boolean;
47
- /**
48
- * When the close button is clicked, the window is hidden instead of closed.
49
- * **The default is false**
50
- */
51
- /**
52
- * Set the order of the elements on the title bar. You can use `inverted`, `first-buttons` or don't add for.
53
- * **The default is undefined**
54
- */
55
- order?: "inverted" | "first-buttons";
56
- /**
57
- * Set horizontal alignment of the window title.
58
- * **The default value is center**
59
- */
60
- titleHorizontalAlignment?: "left" | "center" | "right";
61
- /**
62
- * Sets the value for the overflow of the container after title bar.
63
- * **The default value is auto**
64
- */
65
- containerOverflow?: "auto" | "hidden" | "visible";
66
- }
@@ -1,2 +0,0 @@
1
- import { Color } from "vs/base/common/color";
2
- export declare const applyFill: (element: Element | undefined | null, svgColor: Color | undefined, fgColor: Color | undefined) => void;
@@ -1,40 +0,0 @@
1
- import { Event } from 'vs/base/common/event';
2
- declare class PixelRatioFacade {
3
- private _pixelRatioMonitor;
4
- private _getOrCreatePixelRatioMonitor;
5
- /**
6
- * Get the current value.
7
- */
8
- get value(): number;
9
- /**
10
- * Listen for changes.
11
- */
12
- get onDidChange(): Event<number>;
13
- }
14
- /**
15
- * Returns the pixel ratio.
16
- *
17
- * This is useful for rendering <canvas> elements at native screen resolution or for being used as
18
- * a cache key when storing font measurements. Fonts might render differently depending on resolution
19
- * and any measurements need to be discarded for example when a window is moved from a monitor to another.
20
- */
21
- export declare const PixelRatio: PixelRatioFacade;
22
- /** A zoom index, e.g. 1, 2, 3 */
23
- export declare function setZoomLevel(zoomLevel: number, isTrusted: boolean): void;
24
- export declare function getZoomLevel(): number;
25
- /** The zoom scale for an index, e.g. 1, 1.2, 1.4 */
26
- export declare function getZoomFactor(): number;
27
- export declare function setZoomFactor(zoomFactor: number): void;
28
- export declare function setFullscreen(fullscreen: boolean): void;
29
- export declare function isFullscreen(): boolean;
30
- export declare const onDidChangeFullscreen: Event<void>;
31
- export declare const isFirefox: boolean;
32
- export declare const isWebKit: boolean;
33
- export declare const isChrome: boolean;
34
- export declare const isSafari: boolean;
35
- export declare const isWebkitWebView: boolean;
36
- export declare const isEdgeLegacyWebView: boolean;
37
- export declare const isElectron: boolean;
38
- export declare const isAndroid: boolean;
39
- export declare const isStandalone: boolean;
40
- export {};
@@ -1,17 +0,0 @@
1
- export declare const enum KeyboardSupport {
2
- Always = 0,
3
- FullScreen = 1,
4
- None = 2
5
- }
6
- /**
7
- * Browser feature we can support in current platform, browser and environment.
8
- */
9
- export declare const BrowserFeatures: {
10
- clipboard: {
11
- writeText: true;
12
- readText: boolean;
13
- };
14
- keyboard: KeyboardSupport;
15
- touch: boolean;
16
- pointerEvents: boolean;
17
- };
@@ -1,325 +0,0 @@
1
- import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
2
- import { IMouseEvent } from 'vs/base/browser/mouseEvent';
3
- import * as event from 'vs/base/common/event';
4
- import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
5
- export declare function clearNode(node: HTMLElement): void;
6
- /**
7
- * @deprecated Use node.isConnected directly
8
- */
9
- export declare function isInDOM(node: Node | null): boolean;
10
- export declare function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;
11
- export declare function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
12
- export declare function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;
13
- export interface IAddStandardDisposableListenerSignature {
14
- (node: HTMLElement, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;
15
- (node: HTMLElement, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;
16
- (node: HTMLElement, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;
17
- (node: HTMLElement, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;
18
- (node: HTMLElement, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;
19
- (node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
20
- }
21
- export declare let addStandardDisposableListener: IAddStandardDisposableListenerSignature;
22
- export declare let addStandardDisposableGenericMouseDownListner: (node: HTMLElement, handler: (event: any) => void, useCapture?: boolean) => IDisposable;
23
- export declare let addStandardDisposableGenericMouseUpListner: (node: HTMLElement, handler: (event: any) => void, useCapture?: boolean) => IDisposable;
24
- export declare function addDisposableGenericMouseDownListner(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable;
25
- export declare function addDisposableGenericMouseMoveListner(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable;
26
- export declare function addDisposableGenericMouseUpListner(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable;
27
- export declare function addDisposableNonBubblingMouseOutListener(node: Element, handler: (event: MouseEvent) => void): IDisposable;
28
- export declare function addDisposableNonBubblingPointerOutListener(node: Element, handler: (event: MouseEvent) => void): IDisposable;
29
- export declare function createEventEmitter<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, options?: boolean | AddEventListenerOptions): event.Emitter<HTMLElementEventMap[K]>;
30
- /**
31
- * Schedule a callback to be run at the next animation frame.
32
- * This allows multiple parties to register callbacks that should run at the next animation frame.
33
- * If currently in an animation frame, `runner` will be executed immediately.
34
- * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).
35
- */
36
- export declare let runAtThisOrScheduleAtNextAnimationFrame: (runner: () => void, priority?: number) => IDisposable;
37
- /**
38
- * Schedule a callback to be run at the next animation frame.
39
- * This allows multiple parties to register callbacks that should run at the next animation frame.
40
- * If currently in an animation frame, `runner` will be executed at the next animation frame.
41
- * @return token that can be used to cancel the scheduled runner.
42
- */
43
- export declare let scheduleAtNextAnimationFrame: (runner: () => void, priority?: number) => IDisposable;
44
- export declare function measure(callback: () => void): IDisposable;
45
- export declare function modify(callback: () => void): IDisposable;
46
- /**
47
- * Add a throttled listener. `handler` is fired at most every 8.33333ms or with the next animation frame (if browser supports it).
48
- */
49
- export interface IEventMerger<R, E> {
50
- (lastEvent: R | null, currentEvent: E): R;
51
- }
52
- export declare function addDisposableThrottledListener<R, E extends Event = Event>(node: any, type: string, handler: (event: R) => void, eventMerger?: IEventMerger<R, E>, minimumTimeMs?: number): IDisposable;
53
- export declare function getComputedStyle(el: HTMLElement): CSSStyleDeclaration;
54
- export declare function getClientArea(element: HTMLElement): Dimension;
55
- export interface IDimension {
56
- readonly width: number;
57
- readonly height: number;
58
- }
59
- export declare class Dimension implements IDimension {
60
- readonly width: number;
61
- readonly height: number;
62
- static readonly None: Dimension;
63
- constructor(width: number, height: number);
64
- with(width?: number, height?: number): Dimension;
65
- static is(obj: unknown): obj is IDimension;
66
- static lift(obj: IDimension): Dimension;
67
- static equals(a: Dimension | undefined, b: Dimension | undefined): boolean;
68
- }
69
- export declare function getTopLeftOffset(element: HTMLElement): {
70
- left: number;
71
- top: number;
72
- };
73
- export interface IDomNodePagePosition {
74
- left: number;
75
- top: number;
76
- width: number;
77
- height: number;
78
- }
79
- export declare function size(element: HTMLElement, width: number | null, height: number | null): void;
80
- export declare function position(element: HTMLElement, top: number, right?: number, bottom?: number, left?: number, position?: string): void;
81
- /**
82
- * Returns the position of a dom node relative to the entire page.
83
- */
84
- export declare function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition;
85
- export interface IStandardWindow {
86
- readonly scrollX: number;
87
- readonly scrollY: number;
88
- }
89
- export declare const StandardWindow: IStandardWindow;
90
- export declare function getTotalWidth(element: HTMLElement): number;
91
- export declare function getContentWidth(element: HTMLElement): number;
92
- export declare function getTotalScrollWidth(element: HTMLElement): number;
93
- export declare function getContentHeight(element: HTMLElement): number;
94
- export declare function getTotalHeight(element: HTMLElement): number;
95
- export declare function getLargestChildWidth(parent: HTMLElement, children: HTMLElement[]): number;
96
- export declare function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean;
97
- /**
98
- * Set an explicit parent to use for nodes that are not part of the
99
- * regular dom structure.
100
- */
101
- export declare function setParentFlowTo(fromChildElement: HTMLElement, toParentElement: Element): void;
102
- /**
103
- * Check if `testAncestor` is an ancestor of `testChild`, observing the explicit
104
- * parents set by `setParentFlowTo`.
105
- */
106
- export declare function isAncestorUsingFlowTo(testChild: Node, testAncestor: Node): boolean;
107
- export declare function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null;
108
- export declare function hasParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): boolean;
109
- export declare function isShadowRoot(node: Node): node is ShadowRoot;
110
- export declare function isInShadowDOM(domNode: Node): boolean;
111
- export declare function getShadowRoot(domNode: Node): ShadowRoot | null;
112
- export declare function getActiveElement(): Element | null;
113
- export declare function createStyleSheet(container?: HTMLElement): HTMLStyleElement;
114
- export declare function createMetaElement(container?: HTMLElement): HTMLMetaElement;
115
- export declare function createCSSRule(selector: string, cssText: string, style?: HTMLStyleElement): void;
116
- export declare function removeCSSRulesContainingSelector(ruleName: string, style?: HTMLStyleElement): void;
117
- export declare function isHTMLElement(o: any): o is HTMLElement;
118
- export declare const EventType: {
119
- readonly CLICK: "click";
120
- readonly AUXCLICK: "auxclick";
121
- readonly DBLCLICK: "dblclick";
122
- readonly MOUSE_UP: "mouseup";
123
- readonly MOUSE_DOWN: "mousedown";
124
- readonly MOUSE_OVER: "mouseover";
125
- readonly MOUSE_MOVE: "mousemove";
126
- readonly MOUSE_OUT: "mouseout";
127
- readonly MOUSE_ENTER: "mouseenter";
128
- readonly MOUSE_LEAVE: "mouseleave";
129
- readonly MOUSE_WHEEL: "wheel";
130
- readonly POINTER_UP: "pointerup";
131
- readonly POINTER_DOWN: "pointerdown";
132
- readonly POINTER_MOVE: "pointermove";
133
- readonly CONTEXT_MENU: "contextmenu";
134
- readonly WHEEL: "wheel";
135
- readonly KEY_DOWN: "keydown";
136
- readonly KEY_PRESS: "keypress";
137
- readonly KEY_UP: "keyup";
138
- readonly LOAD: "load";
139
- readonly BEFORE_UNLOAD: "beforeunload";
140
- readonly UNLOAD: "unload";
141
- readonly PAGE_SHOW: "pageshow";
142
- readonly PAGE_HIDE: "pagehide";
143
- readonly ABORT: "abort";
144
- readonly ERROR: "error";
145
- readonly RESIZE: "resize";
146
- readonly SCROLL: "scroll";
147
- readonly FULLSCREEN_CHANGE: "fullscreenchange";
148
- readonly WK_FULLSCREEN_CHANGE: "webkitfullscreenchange";
149
- readonly SELECT: "select";
150
- readonly CHANGE: "change";
151
- readonly SUBMIT: "submit";
152
- readonly RESET: "reset";
153
- readonly FOCUS: "focus";
154
- readonly FOCUS_IN: "focusin";
155
- readonly FOCUS_OUT: "focusout";
156
- readonly BLUR: "blur";
157
- readonly INPUT: "input";
158
- readonly STORAGE: "storage";
159
- readonly DRAG_START: "dragstart";
160
- readonly DRAG: "drag";
161
- readonly DRAG_ENTER: "dragenter";
162
- readonly DRAG_LEAVE: "dragleave";
163
- readonly DRAG_OVER: "dragover";
164
- readonly DROP: "drop";
165
- readonly DRAG_END: "dragend";
166
- readonly ANIMATION_START: "webkitAnimationStart" | "animationstart";
167
- readonly ANIMATION_END: "webkitAnimationEnd" | "animationend";
168
- readonly ANIMATION_ITERATION: "webkitAnimationIteration" | "animationiteration";
169
- };
170
- export interface EventLike {
171
- preventDefault(): void;
172
- stopPropagation(): void;
173
- }
174
- export declare const EventHelper: {
175
- stop: (e: EventLike, cancelBubble?: boolean) => void;
176
- };
177
- export interface IFocusTracker extends Disposable {
178
- onDidFocus: event.Event<void>;
179
- onDidBlur: event.Event<void>;
180
- refreshState(): void;
181
- }
182
- export declare function saveParentsScrollTop(node: Element): number[];
183
- export declare function restoreParentsScrollTop(node: Element, state: number[]): void;
184
- export declare function trackFocus(element: HTMLElement | Window): IFocusTracker;
185
- export declare function after<T extends Node>(sibling: HTMLElement, child: T): T;
186
- export declare function append<T extends Node>(parent: HTMLElement, child: T): T;
187
- export declare function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): void;
188
- export declare function prepend<T extends Node>(parent: HTMLElement, child: T): T;
189
- /**
190
- * Removes all children from `parent` and appends `children`
191
- */
192
- export declare function reset(parent: HTMLElement, ...children: Array<Node | string>): void;
193
- export declare enum Namespace {
194
- HTML = "http://www.w3.org/1999/xhtml",
195
- SVG = "http://www.w3.org/2000/svg"
196
- }
197
- export declare function $<T extends HTMLElement>(description: string, attrs?: {
198
- [key: string]: any;
199
- }, ...children: Array<Node | string>): T;
200
- export declare namespace $ {
201
- var SVG: <T extends SVGElement>(description: string, attrs?: {
202
- [key: string]: any;
203
- } | undefined, ...children: (string | Node)[]) => T;
204
- }
205
- export declare function join(nodes: Node[], separator: Node | string): Node[];
206
- export declare function show(...elements: HTMLElement[]): void;
207
- export declare function hide(...elements: HTMLElement[]): void;
208
- export declare function removeTabIndexAndUpdateFocus(node: HTMLElement): void;
209
- export declare function getElementsByTagName(tag: string): HTMLElement[];
210
- export declare function finalHandler<T extends Event>(fn: (event: T) => any): (event: T) => any;
211
- export declare function domContentLoaded(): Promise<unknown>;
212
- /**
213
- * Find a value usable for a dom node size such that the likelihood that it would be
214
- * displayed with constant screen pixels size is as high as possible.
215
- *
216
- * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio
217
- * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/"snaps"
218
- * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.
219
- */
220
- export declare function computeScreenAwareSize(cssPx: number): number;
221
- /**
222
- * Open safely a new window. This is the best way to do so, but you cannot tell
223
- * if the window was opened or if it was blocked by the browser's popup blocker.
224
- * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.
225
- *
226
- * See https://github.com/microsoft/monaco-editor/issues/601
227
- * To protect against malicious code in the linked site, particularly phishing attempts,
228
- * the window.opener should be set to null to prevent the linked site from having access
229
- * to change the location of the current page.
230
- * See https://mathiasbynens.github.io/rel-noopener/
231
- */
232
- export declare function windowOpenNoOpener(url: string): void;
233
- export declare function windowOpenPopup(url: string): void;
234
- /**
235
- * Attempts to open a window and returns whether it succeeded. This technique is
236
- * not appropriate in certain contexts, like for example when the JS context is
237
- * executing inside a sandboxed iframe. If it is not necessary to know if the
238
- * browser blocked the new window, use {@link windowOpenNoOpener}.
239
- *
240
- * See https://github.com/microsoft/monaco-editor/issues/601
241
- * See https://github.com/microsoft/monaco-editor/issues/2474
242
- * See https://mathiasbynens.github.io/rel-noopener/
243
- *
244
- * @param url the url to open
245
- * @param noOpener whether or not to set the {@link window.opener} to null. You should leave the default
246
- * (true) unless you trust the url that is being opened.
247
- * @returns boolean indicating if the {@link window.open} call succeeded
248
- */
249
- export declare function windowOpenWithSuccess(url: string, noOpener?: boolean): boolean;
250
- export declare function animate(fn: () => void): IDisposable;
251
- export declare enum DetectedFullscreenMode {
252
- /**
253
- * The document is fullscreen, e.g. because an element
254
- * in the document requested to be fullscreen.
255
- */
256
- DOCUMENT = 1,
257
- /**
258
- * The browser is fullscreen, e.g. because the user enabled
259
- * native window fullscreen for it.
260
- */
261
- BROWSER = 2
262
- }
263
- export interface IDetectedFullscreen {
264
- /**
265
- * Figure out if the document is fullscreen or the browser.
266
- */
267
- mode: DetectedFullscreenMode;
268
- /**
269
- * Whether we know for sure that we are in fullscreen mode or
270
- * it is a guess.
271
- */
272
- guess: boolean;
273
- }
274
- export declare function detectFullscreen(): IDetectedFullscreen | null;
275
- /**
276
- * Version of the global `btoa` function that handles multi-byte characters instead
277
- * of throwing an exception.
278
- */
279
- export declare function multibyteAwareBtoa(str: string): string;
280
- /**
281
- * Typings for the https://wicg.github.io/file-system-access
282
- *
283
- * Use `supported(window)` to find out if the browser supports this kind of API.
284
- */
285
- export declare namespace WebFileSystemAccess {
286
- function supported(obj: any & Window): boolean;
287
- }
288
- declare type ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';
289
- export interface IModifierKeyStatus {
290
- altKey: boolean;
291
- shiftKey: boolean;
292
- ctrlKey: boolean;
293
- metaKey: boolean;
294
- lastKeyPressed?: ModifierKey;
295
- lastKeyReleased?: ModifierKey;
296
- event?: KeyboardEvent;
297
- }
298
- export declare class ModifierKeyEmitter extends event.Emitter<IModifierKeyStatus> {
299
- private readonly _subscriptions;
300
- private _keyStatus;
301
- private static instance;
302
- private constructor();
303
- get keyStatus(): IModifierKeyStatus;
304
- get isModifierPressed(): boolean;
305
- /**
306
- * Allows to explicitly reset the key status based on more knowledge (#109062)
307
- */
308
- resetKeyStatus(): void;
309
- private doResetKeyStatus;
310
- static getInstance(): ModifierKeyEmitter;
311
- dispose(): void;
312
- }
313
- export declare function getCookieValue(name: string): string | undefined;
314
- export declare function addMatchMediaChangeListener(query: string, callback: () => void): void;
315
- export declare const enum ZIndex {
316
- SASH = 35,
317
- SuggestWidget = 40,
318
- Hover = 50,
319
- DragImage = 1000,
320
- MenubarMenuItemsHolder = 2000,
321
- ContextView = 2500,
322
- ModalDialog = 2600,
323
- PaneDropOverlay = 10000
324
- }
325
- export {};
@@ -1,27 +0,0 @@
1
- import { GestureEvent } from 'vs/base/browser/touch';
2
- import { Event as BaseEvent } from 'vs/base/common/event';
3
- import { IDisposable } from 'vs/base/common/lifecycle';
4
- export declare type EventHandler = HTMLElement | HTMLDocument | Window;
5
- export interface IDomEvent {
6
- <K extends keyof HTMLElementEventMap>(element: EventHandler, type: K, useCapture?: boolean): BaseEvent<HTMLElementEventMap[K]>;
7
- (element: EventHandler, type: string, useCapture?: boolean): BaseEvent<unknown>;
8
- }
9
- export interface DOMEventMap extends HTMLElementEventMap, DocumentEventMap, WindowEventMap {
10
- '-monaco-gesturetap': GestureEvent;
11
- '-monaco-gesturechange': GestureEvent;
12
- '-monaco-gesturestart': GestureEvent;
13
- '-monaco-gesturesend': GestureEvent;
14
- '-monaco-gesturecontextmenu': GestureEvent;
15
- }
16
- export declare class DomEmitter<K extends keyof DOMEventMap> implements IDisposable {
17
- private emitter;
18
- constructor(element: Window & typeof globalThis, type: WindowEventMap, useCapture?: boolean);
19
- constructor(element: Document, type: DocumentEventMap, useCapture?: boolean);
20
- constructor(element: EventHandler, type: K, useCapture?: boolean);
21
- dispose(): void;
22
- }
23
- export interface CancellableEvent {
24
- preventDefault(): void;
25
- stopPropagation(): void;
26
- }
27
- export declare function stopEvent<T extends CancellableEvent>(event: T): T;