custom-electron-titlebar 4.2.0 → 4.2.2

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 (65) hide show
  1. package/dist/base/browser/browser.d.ts +26 -0
  2. package/dist/base/browser/browser.js +317 -0
  3. package/dist/base/browser/event.d.ts +12 -0
  4. package/dist/base/browser/event.js +215 -0
  5. package/dist/base/browser/keyboardEvent.d.ts +38 -0
  6. package/dist/base/browser/keyboardEvent.js +466 -0
  7. package/dist/base/browser/mouseEvent.d.ts +61 -0
  8. package/dist/base/browser/mouseEvent.js +327 -0
  9. package/dist/base/browser/touch.d.ts +39 -0
  10. package/dist/base/browser/touch.js +454 -0
  11. package/dist/base/common/arrays.d.ts +10 -0
  12. package/dist/base/common/arrays.js +210 -0
  13. package/dist/base/common/async.d.ts +35 -0
  14. package/dist/base/common/async.js +280 -0
  15. package/dist/base/common/charCode.d.ts +405 -0
  16. package/dist/base/common/charCode.js +9 -0
  17. package/dist/base/common/color.d.ts +159 -0
  18. package/dist/base/common/color.js +709 -0
  19. package/dist/base/common/decorators.d.ts +6 -0
  20. package/dist/base/common/decorators.js +300 -0
  21. package/dist/base/common/dom.d.ts +221 -0
  22. package/dist/base/common/dom.js +1478 -0
  23. package/dist/base/common/event.d.ts +213 -0
  24. package/dist/base/common/event.js +804 -0
  25. package/dist/base/common/iterator.d.ts +69 -0
  26. package/dist/base/common/iterator.js +381 -0
  27. package/dist/base/common/keyCodes.d.ts +478 -0
  28. package/dist/base/common/keyCodes.js +479 -0
  29. package/dist/base/common/lifecycle.d.ts +17 -0
  30. package/dist/base/common/lifecycle.js +258 -0
  31. package/dist/base/common/linkedList.d.ts +17 -0
  32. package/dist/base/common/linkedList.js +319 -0
  33. package/dist/base/common/platform.d.ts +33 -0
  34. package/dist/base/common/platform.js +302 -0
  35. package/dist/base/common/strings.d.ts +23 -0
  36. package/dist/base/common/strings.js +273 -0
  37. package/dist/consts.d.ts +49 -0
  38. package/dist/consts.js +303 -0
  39. package/dist/index.d.ts +3 -0
  40. package/dist/index.js +211 -0
  41. package/dist/main/attach-titlebar-to-window.d.ts +3 -0
  42. package/dist/main/attach-titlebar-to-window.js +207 -0
  43. package/dist/main/index.d.ts +3 -0
  44. package/dist/main/index.js +202 -0
  45. package/dist/main/setup-titlebar.d.ts +2 -0
  46. package/dist/main/setup-titlebar.js +242 -0
  47. package/dist/menubar/index.d.ts +86 -0
  48. package/dist/menubar/index.js +1118 -0
  49. package/dist/menubar/menu/index.d.ts +46 -0
  50. package/dist/menubar/menu/index.js +556 -0
  51. package/dist/menubar/menu/item.d.ts +67 -0
  52. package/dist/menubar/menu/item.js +575 -0
  53. package/dist/menubar/menu/separator.d.ts +11 -0
  54. package/dist/menubar/menu/separator.js +213 -0
  55. package/dist/menubar/menu/submenu.d.ts +32 -0
  56. package/dist/menubar/menu/submenu.js +372 -0
  57. package/dist/menubar/menubar-options.d.ts +55 -0
  58. package/dist/menubar/menubar-options.js +9 -0
  59. package/dist/titlebar/index.d.ts +99 -0
  60. package/dist/titlebar/index.js +664 -0
  61. package/dist/titlebar/options.d.ts +84 -0
  62. package/dist/titlebar/options.js +9 -0
  63. package/dist/titlebar/themebar.d.ts +20 -0
  64. package/dist/titlebar/themebar.js +267 -0
  65. package/package.json +1 -1
@@ -0,0 +1,213 @@
1
+ import { IDisposable } from '../common/lifecycle';
2
+ import { LinkedList } from '../common/linkedList';
3
+ /**
4
+ * To an event a function with one or zero parameters
5
+ * can be subscribed. The event is the subscriber function itself.
6
+ */
7
+ export interface Event<T> {
8
+ (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
9
+ }
10
+ export declare namespace Event {
11
+ const None: Event<any>;
12
+ /**
13
+ * Given an event, returns another event which only fires once.
14
+ */
15
+ function once<T>(event: Event<T>): Event<T>;
16
+ /**
17
+ * Given an event and a `map` function, returns another event which maps each element
18
+ * throught the mapping function.
19
+ */
20
+ function map<I, O>(event: Event<I>, map: (i: I) => O): Event<O>;
21
+ /**
22
+ * Given an event and an `each` function, returns another identical event and calls
23
+ * the `each` function per each element.
24
+ */
25
+ function forEach<I>(event: Event<I>, each: (i: I) => void): Event<I>;
26
+ /**
27
+ * Given an event and a `filter` function, returns another event which emits those
28
+ * elements for which the `filter` function returns `true`.
29
+ */
30
+ function filter<T>(event: Event<T>, filter: (e: T) => boolean): Event<T>;
31
+ function filter<T, R>(event: Event<T | R>, filter: (e: T | R) => e is R): Event<R>;
32
+ /**
33
+ * Given an event, returns the same event but typed as `Event<void>`.
34
+ */
35
+ function signal<T>(event: Event<T>): Event<void>;
36
+ /**
37
+ * Given a collection of events, returns a single event which emits
38
+ * whenever any of the provided events emit.
39
+ */
40
+ function any<T>(...events: Event<T>[]): Event<T>;
41
+ /**
42
+ * Given an event and a `merge` function, returns another event which maps each element
43
+ * and the cummulative result throught the `merge` function. Similar to `map`, but with memory.
44
+ */
45
+ function reduce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, initial?: O): Event<O>;
46
+ /**
47
+ * Debounces the provided event, given a `merge` function.
48
+ *
49
+ * @param event The input event.
50
+ * @param merge The reducing function.
51
+ * @param delay The debouncing delay in millis.
52
+ * @param leading Whether the event should fire in the leading phase of the timeout.
53
+ * @param leakWarningThreshold The leak warning threshold override.
54
+ */
55
+ function debounce<T>(event: Event<T>, merge: (last: T, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number): Event<T>;
56
+ function debounce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, delay?: number, leading?: boolean, leakWarningThreshold?: number): Event<O>;
57
+ /**
58
+ * Given an event, it returns another event which fires only once and as soon as
59
+ * the input event emits. The event data is the number of millis it took for the
60
+ * event to fire.
61
+ */
62
+ function stopwatch<T>(event: Event<T>): Event<number>;
63
+ /**
64
+ * Given an event, it returns another event which fires only when the event
65
+ * element changes.
66
+ */
67
+ function latch<T>(event: Event<T>): Event<T>;
68
+ /**
69
+ * Buffers the provided event until a first listener comes
70
+ * along, at which point fire all the events at once and
71
+ * pipe the event from then on.
72
+ *
73
+ * ```typescript
74
+ * const emitter = new Emitter<number>();
75
+ * const event = emitter.event;
76
+ * const bufferedEvent = buffer(event);
77
+ *
78
+ * emitter.fire(1);
79
+ * emitter.fire(2);
80
+ * emitter.fire(3);
81
+ * // nothing...
82
+ *
83
+ * const listener = bufferedEvent(num => console.log(num));
84
+ * // 1, 2, 3
85
+ *
86
+ * emitter.fire(4);
87
+ * // 4
88
+ * ```
89
+ */
90
+ function buffer<T>(event: Event<T>, nextTick?: boolean, _buffer?: T[]): Event<T>;
91
+ /**
92
+ * Similar to `buffer` but it buffers indefinitely and repeats
93
+ * the buffered events to every new listener.
94
+ */
95
+ function echo<T>(event: Event<T>, nextTick?: boolean, buffer?: T[]): Event<T>;
96
+ interface IChainableEvent<T> {
97
+ event: Event<T>;
98
+ map<O>(fn: (i: T) => O): IChainableEvent<O>;
99
+ forEach(fn: (i: T) => void): IChainableEvent<T>;
100
+ filter(fn: (e: T) => boolean): IChainableEvent<T>;
101
+ reduce<R>(merge: (last: R | undefined, event: T) => R, initial?: R): IChainableEvent<R>;
102
+ latch(): IChainableEvent<T>;
103
+ on(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
104
+ once(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
105
+ }
106
+ function chain<T>(event: Event<T>): IChainableEvent<T>;
107
+ interface NodeEventEmitter {
108
+ on(event: string | symbol, listener: Function): this;
109
+ removeListener(event: string | symbol, listener: Function): this;
110
+ }
111
+ function fromNodeEventEmitter<T>(emitter: NodeEventEmitter, eventName: string, map?: (...args: any[]) => T): Event<T>;
112
+ function fromPromise<T = any>(promise: Promise<T>): Event<undefined>;
113
+ function toPromise<T>(event: Event<T>): Promise<T>;
114
+ }
115
+ type Listener<T> = [(e: T) => void, any] | ((e: T) => void);
116
+ export interface EmitterOptions {
117
+ onFirstListenerAdd?: Function;
118
+ onFirstListenerDidAdd?: Function;
119
+ onListenerDidAdd?: Function;
120
+ onLastListenerRemove?: Function;
121
+ leakWarningThreshold?: number;
122
+ }
123
+ export declare function setGlobalLeakWarningThreshold(n: number): IDisposable;
124
+ /**
125
+ * The Emitter can be used to expose an Event to the public
126
+ * to fire it from the insides.
127
+ * Sample:
128
+ class Document {
129
+
130
+ private _onDidChange = new Emitter<(value:string)=>any>();
131
+
132
+ public onDidChange = this._onDidChange.event;
133
+
134
+ // getter-style
135
+ // get onDidChange(): Event<(value:string)=>any> {
136
+ // return this._onDidChange.event;
137
+ // }
138
+
139
+ private _doIt() {
140
+ //...
141
+ this._onDidChange.fire(value);
142
+ }
143
+ }
144
+ */
145
+ export declare class Emitter<T> {
146
+ private static readonly _noop;
147
+ private readonly _options?;
148
+ private readonly _leakageMon?;
149
+ private _disposed;
150
+ private _event?;
151
+ private _deliveryQueue?;
152
+ protected _listeners?: LinkedList<Listener<T>>;
153
+ constructor(options?: EmitterOptions);
154
+ /**
155
+ * For the public to allow to subscribe
156
+ * to events from this Emitter
157
+ */
158
+ get event(): Event<T>;
159
+ /**
160
+ * To be kept private to fire an event to
161
+ * subscribers
162
+ */
163
+ fire(event: T): void;
164
+ dispose(): void;
165
+ }
166
+ export interface IWaitUntil {
167
+ waitUntil(thenable: Promise<any>): void;
168
+ }
169
+ export declare class AsyncEmitter<T extends IWaitUntil> extends Emitter<T> {
170
+ private _asyncDeliveryQueue?;
171
+ fireAsync(eventFn: (thenables: Promise<any>[], listener: Function) => T): Promise<void>;
172
+ }
173
+ /**
174
+ * The EventBufferer is useful in situations in which you want
175
+ * to delay firing your events during some code.
176
+ * You can wrap that code and be sure that the event will not
177
+ * be fired during that wrap.
178
+ *
179
+ * ```
180
+ * const emitter: Emitter;
181
+ * const delayer = new EventDelayer();
182
+ * const delayedEvent = delayer.wrapEvent(emitter.event);
183
+ *
184
+ * delayedEvent(console.log);
185
+ *
186
+ * delayer.bufferEvents(() => {
187
+ * emitter.fire(); // event will not be fired yet
188
+ * });
189
+ *
190
+ * // event will only be fired at this point
191
+ * ```
192
+ */
193
+ export declare class EventBufferer {
194
+ private buffers;
195
+ wrapEvent<T>(event: Event<T>): Event<T>;
196
+ bufferEvents<R = void>(fn: () => R): R;
197
+ }
198
+ /**
199
+ * A Relay is an event forwarder which functions as a replugabble event pipe.
200
+ * Once created, you can connect an input event to it and it will simply forward
201
+ * events from that input event through its own `event` property. The `input`
202
+ * can be changed at any point in time.
203
+ */
204
+ export declare class Relay<T> implements IDisposable {
205
+ private listening;
206
+ private inputEvent;
207
+ private inputEventListener;
208
+ private emitter;
209
+ readonly event: Event<T>;
210
+ set input(event: Event<T>);
211
+ dispose(): void;
212
+ }
213
+ export {};