@jupyterlab/apputils 4.0.0-alpha.2 → 4.0.0-alpha.20
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/lib/clipboard.d.ts +1 -1
- package/lib/dialog.d.ts +73 -4
- package/lib/dialog.js +143 -30
- package/lib/dialog.js.map +1 -1
- package/lib/domutils.js.map +1 -1
- package/lib/index.d.ts +6 -5
- package/lib/index.js +6 -5
- package/lib/index.js.map +1 -1
- package/lib/inputdialog.d.ts +35 -3
- package/lib/inputdialog.js +122 -12
- package/lib/inputdialog.js.map +1 -1
- package/lib/kernelstatuses.d.ts +74 -2
- package/lib/kernelstatuses.js +142 -2
- package/lib/kernelstatuses.js.map +1 -1
- package/lib/mainareawidget.d.ts +9 -0
- package/lib/mainareawidget.js +29 -4
- package/lib/mainareawidget.js.map +1 -1
- package/lib/menufactory.js +14 -15
- package/lib/menufactory.js.map +1 -1
- package/lib/notification.d.ts +336 -0
- package/lib/notification.js +310 -0
- package/lib/notification.js.map +1 -0
- package/lib/runningSessions.d.ts +72 -0
- package/lib/runningSessions.js +119 -0
- package/lib/runningSessions.js.map +1 -0
- package/lib/sanitizer.d.ts +6 -4
- package/lib/sanitizer.js +32 -12
- package/lib/sanitizer.js.map +1 -1
- package/lib/semanticCommand.js +11 -2
- package/lib/semanticCommand.js.map +1 -1
- package/lib/sessioncontext.d.ts +2 -3
- package/lib/sessioncontext.js +46 -27
- package/lib/sessioncontext.js.map +1 -1
- package/lib/testutils.d.ts +5 -0
- package/lib/testutils.js +46 -0
- package/lib/testutils.js.map +1 -0
- package/lib/thememanager.js +13 -4
- package/lib/thememanager.js.map +1 -1
- package/lib/tokens.d.ts +26 -9
- package/lib/tokens.js +1 -6
- package/lib/tokens.js.map +1 -1
- package/lib/toolbar/factory.d.ts +12 -2
- package/lib/toolbar/factory.js +237 -145
- package/lib/toolbar/factory.js.map +1 -1
- package/lib/toolbar/index.js +4 -0
- package/lib/toolbar/index.js.map +1 -1
- package/lib/toolbar/registry.d.ts +11 -0
- package/lib/toolbar/registry.js +20 -3
- package/lib/toolbar/registry.js.map +1 -1
- package/lib/toolbar/widget.d.ts +3 -0
- package/lib/toolbar/widget.js +3 -0
- package/lib/toolbar/widget.js.map +1 -1
- package/lib/widgettracker.d.ts +13 -1
- package/lib/widgettracker.js +29 -2
- package/lib/widgettracker.js.map +1 -1
- package/package.json +30 -30
- package/src/clipboard.ts +107 -0
- package/src/commandlinker.ts +209 -0
- package/src/commandpalette.ts +175 -0
- package/src/dialog.tsx +1133 -0
- package/src/domutils.ts +53 -0
- package/src/index.ts +78 -0
- package/src/inputdialog.ts +551 -0
- package/src/kernelstatuses.tsx +279 -0
- package/src/mainareawidget.ts +362 -0
- package/src/menufactory.ts +201 -0
- package/src/notification.ts +559 -0
- package/src/printing.ts +180 -0
- package/src/runningSessions.tsx +233 -0
- package/src/sanitizer.ts +968 -0
- package/src/semanticCommand.ts +77 -0
- package/src/sessioncontext.tsx +1712 -0
- package/src/testutils.ts +49 -0
- package/src/thememanager.ts +519 -0
- package/src/tokens.ts +372 -0
- package/src/toolbar/factory.ts +422 -0
- package/src/toolbar/index.ts +8 -0
- package/src/toolbar/registry.ts +158 -0
- package/src/toolbar/widget.tsx +243 -0
- package/src/widgettracker.ts +391 -0
- package/src/windowresolver.ts +218 -0
- package/style/base.css +0 -1
- package/style/commandpalette.css +7 -10
- package/style/dialog.css +23 -7
- package/style/index.css +1 -0
- package/style/index.js +1 -0
- package/style/inputdialog.css +5 -0
- package/style/materialcolors.css +8 -21
- package/lib/hoverbox.d.ts +0 -82
- package/lib/hoverbox.js +0 -100
- package/lib/hoverbox.js.map +0 -1
- package/style/hoverbox.css +0 -13
package/lib/mainareawidget.js
CHANGED
|
@@ -6,6 +6,10 @@ import { MessageLoop } from '@lumino/messaging';
|
|
|
6
6
|
import { BoxLayout, BoxPanel, Widget } from '@lumino/widgets';
|
|
7
7
|
import { DOMUtils } from './domutils';
|
|
8
8
|
import { Printing } from './printing';
|
|
9
|
+
/**
|
|
10
|
+
* A flag to indicate that event handlers are caught in the capture phase.
|
|
11
|
+
*/
|
|
12
|
+
const USE_CAPTURE = true;
|
|
9
13
|
/**
|
|
10
14
|
* A widget meant to be contained in the JupyterLab main area.
|
|
11
15
|
*
|
|
@@ -26,6 +30,11 @@ export class MainAreaWidget extends Widget {
|
|
|
26
30
|
this._changeGuard = false;
|
|
27
31
|
this._spinner = new Spinner();
|
|
28
32
|
this._isRevealed = false;
|
|
33
|
+
this._evtMouseDown = () => {
|
|
34
|
+
if (!this.node.contains(document.activeElement)) {
|
|
35
|
+
this._focusContent();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
29
38
|
this.addClass('jp-MainAreaWidget');
|
|
30
39
|
// Set contain=strict to avoid many forced layout rendering while adding cells.
|
|
31
40
|
// Don't forget to remove the CSS class when your remove the spinner to allow
|
|
@@ -57,7 +66,7 @@ export class MainAreaWidget extends Widget {
|
|
|
57
66
|
if (!content.id) {
|
|
58
67
|
content.id = DOMUtils.createDomID();
|
|
59
68
|
}
|
|
60
|
-
content.node.tabIndex =
|
|
69
|
+
content.node.tabIndex = -1;
|
|
61
70
|
this._updateTitle();
|
|
62
71
|
content.title.changed.connect(this._updateTitle, this);
|
|
63
72
|
this.title.closable = true;
|
|
@@ -151,14 +160,30 @@ export class MainAreaWidget extends Widget {
|
|
|
151
160
|
*/
|
|
152
161
|
onActivateRequest(msg) {
|
|
153
162
|
if (this._isRevealed) {
|
|
154
|
-
|
|
155
|
-
this._focusContent();
|
|
156
|
-
}
|
|
163
|
+
this._focusContent();
|
|
157
164
|
}
|
|
158
165
|
else {
|
|
159
166
|
this._spinner.node.focus();
|
|
160
167
|
}
|
|
161
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Handle `after-attach` messages for the widget.
|
|
171
|
+
*/
|
|
172
|
+
onAfterAttach(msg) {
|
|
173
|
+
super.onAfterAttach(msg);
|
|
174
|
+
// Focus content in capture phase to ensure relevant commands operate on the
|
|
175
|
+
// current main area widget.
|
|
176
|
+
// Add the event listener directly instead of using `handleEvent` in order
|
|
177
|
+
// to save sub-classes from needing to reason about calling it as well.
|
|
178
|
+
this.node.addEventListener('mousedown', this._evtMouseDown, USE_CAPTURE);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Handle `before-detach` messages for the widget.
|
|
182
|
+
*/
|
|
183
|
+
onBeforeDetach(msg) {
|
|
184
|
+
this.node.removeEventListener('mousedown', this._evtMouseDown, USE_CAPTURE);
|
|
185
|
+
super.onBeforeDetach(msg);
|
|
186
|
+
}
|
|
162
187
|
/**
|
|
163
188
|
* Handle `'close-request'` messages.
|
|
164
189
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mainareawidget.js","sourceRoot":"","sources":["../src/mainareawidget.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAW,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAW,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,OAAO,cACX,SAAQ,MAAM;
|
|
1
|
+
{"version":3,"file":"mainareawidget.js","sourceRoot":"","sources":["../src/mainareawidget.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAW,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAW,WAAW,EAAE,MAAM,mBAAmB,CAA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,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;SACR;QACD,iEAAiE;QACjE,cAAc;QACd,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YACvD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;SAC3B;QAED,oEAAoE;QACpE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CAuBF"}
|
package/lib/menufactory.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
12
5
|
import { Text } from '@jupyterlab/coreutils';
|
|
13
6
|
import { LabIcon } from '@jupyterlab/ui-components';
|
|
14
7
|
import { JSONExt } from '@lumino/coreutils';
|
|
@@ -66,9 +59,12 @@ export var MenuFactory;
|
|
|
66
59
|
* @param menuFactory Empty menu factory
|
|
67
60
|
*/
|
|
68
61
|
function addContextItem(item, menu, menuFactory) {
|
|
69
|
-
const { submenu
|
|
62
|
+
const { submenu, ...newItem } = item;
|
|
70
63
|
// Commands may not have been registered yet; so we don't force it to exist
|
|
71
|
-
menu.addItem(
|
|
64
|
+
menu.addItem({
|
|
65
|
+
...newItem,
|
|
66
|
+
submenu: submenu ? dataToMenu(submenu, menuFactory) : null
|
|
67
|
+
});
|
|
72
68
|
}
|
|
73
69
|
MenuFactory.addContextItem = addContextItem;
|
|
74
70
|
/**
|
|
@@ -79,9 +75,12 @@ export var MenuFactory;
|
|
|
79
75
|
* @param menuFactory Empty menu factory
|
|
80
76
|
*/
|
|
81
77
|
function addItem(item, menu, menuFactory) {
|
|
82
|
-
const { submenu
|
|
78
|
+
const { submenu, ...newItem } = item;
|
|
83
79
|
// Commands may not have been registered yet; so we don't force it to exist
|
|
84
|
-
menu.addItem(
|
|
80
|
+
menu.addItem({
|
|
81
|
+
...newItem,
|
|
82
|
+
submenu: submenu ? dataToMenu(submenu, menuFactory) : null
|
|
83
|
+
});
|
|
85
84
|
}
|
|
86
85
|
/**
|
|
87
86
|
* Update an existing list of menu and returns
|
package/lib/menufactory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menufactory.js","sourceRoot":"","sources":["../src/menufactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"menufactory.js","sourceRoot":"","sources":["../src/menufactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE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E,OAAK,MAAA,KAAK,CAAC,OAAO,0CAAE,EAAE,CAAA,CAAA;iBAAA,CACtC,CAAC;gBAEF,IAAI,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE;oBAC9C,IAAI,KAAK,CAAC,QAAQ,EAAE;wBAClB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;qBAC/B;yBAAM;wBACL,QAAQ,MAAA,KAAK,CAAC,IAAI,mCAAI,SAAS,EAAE;4BAC/B,KAAK,SAAS;gCACZ,IAAI,KAAK,CAAC,OAAO,EAAE;oCACjB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAA,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAC,EAAE;wCAC3D,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;qCACnC;iCACF;gCACD,MAAM;4BACR,KAAK,SAAS;gCACZ,IAAI,KAAK,CAAC,OAAO,EAAE;oCACjB,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,OAAQ,EAAE,WAAW,CAAC,CAAC;iCAC/D;yBACJ;qBACF;iBACF;qBAAM;oBACL,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;iBACnC;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;AACH,CAAC,EA1LgB,WAAW,KAAX,WAAW,QA0L3B"}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { ReadonlyJSONValue } from '@lumino/coreutils';
|
|
2
|
+
import { IDisposable } from '@lumino/disposable';
|
|
3
|
+
import { ISignal } from '@lumino/signaling';
|
|
4
|
+
/**
|
|
5
|
+
* Notification manager
|
|
6
|
+
*/
|
|
7
|
+
export declare class NotificationManager implements IDisposable {
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Signal emitted whenever a notification changes.
|
|
11
|
+
*/
|
|
12
|
+
get changed(): ISignal<NotificationManager, Notification.IChange>;
|
|
13
|
+
/**
|
|
14
|
+
* Total number of notifications.
|
|
15
|
+
*/
|
|
16
|
+
get count(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the manager is disposed or not.
|
|
19
|
+
*/
|
|
20
|
+
get isDisposed(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The list of notifications.
|
|
23
|
+
*/
|
|
24
|
+
get notifications(): Notification.INotification[];
|
|
25
|
+
/**
|
|
26
|
+
* Dismiss one notification (specified by its id) or all if no id provided.
|
|
27
|
+
*
|
|
28
|
+
* @param id Notification id
|
|
29
|
+
*/
|
|
30
|
+
dismiss(id?: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Dispose the manager.
|
|
33
|
+
*/
|
|
34
|
+
dispose(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Test whether a notification exists or not.
|
|
37
|
+
*
|
|
38
|
+
* @param id Notification id
|
|
39
|
+
* @returns Notification status
|
|
40
|
+
*/
|
|
41
|
+
has(id: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Add a new notification.
|
|
44
|
+
*
|
|
45
|
+
* This will trigger the `changed` signal with an `added` event.
|
|
46
|
+
*
|
|
47
|
+
* @param message Notification message
|
|
48
|
+
* @param type Notification type
|
|
49
|
+
* @param options Notification option
|
|
50
|
+
* @returns Notification unique id
|
|
51
|
+
*/
|
|
52
|
+
notify<T extends ReadonlyJSONValue = ReadonlyJSONValue>(message: string, type: Notification.TypeOptions, options: Notification.IOptions<T>): string;
|
|
53
|
+
/**
|
|
54
|
+
* Update an existing notification.
|
|
55
|
+
*
|
|
56
|
+
* If the notification does not exists this won't do anything.
|
|
57
|
+
*
|
|
58
|
+
* Once updated the notification will be moved at the begin
|
|
59
|
+
* of the notification stack.
|
|
60
|
+
*
|
|
61
|
+
* @param args Update options
|
|
62
|
+
* @returns Whether the update was successful or not.
|
|
63
|
+
*/
|
|
64
|
+
update<T extends ReadonlyJSONValue = ReadonlyJSONValue>(args: Notification.IUpdate<T>): boolean;
|
|
65
|
+
private _isDisposed;
|
|
66
|
+
private _changed;
|
|
67
|
+
private _queue;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Notification namespace
|
|
71
|
+
*/
|
|
72
|
+
export declare namespace Notification {
|
|
73
|
+
/**
|
|
74
|
+
* Enumeration of available action display type.
|
|
75
|
+
*/
|
|
76
|
+
type ActionDisplayType = 'default' | 'accent' | 'warn' | 'link';
|
|
77
|
+
/**
|
|
78
|
+
* Interface describing an action linked to a notification.
|
|
79
|
+
*/
|
|
80
|
+
interface IAction {
|
|
81
|
+
/**
|
|
82
|
+
* The action label.
|
|
83
|
+
*
|
|
84
|
+
* This should be a short description.
|
|
85
|
+
*/
|
|
86
|
+
label: string;
|
|
87
|
+
/**
|
|
88
|
+
* Callback function to trigger
|
|
89
|
+
*
|
|
90
|
+
* ### Notes
|
|
91
|
+
* By default execution of the callback will close the toast
|
|
92
|
+
* and dismiss the notification. You can prevent this by calling
|
|
93
|
+
* `event.preventDefault()` in the callback.
|
|
94
|
+
*/
|
|
95
|
+
callback: (event: MouseEvent) => void;
|
|
96
|
+
/**
|
|
97
|
+
* The action caption.
|
|
98
|
+
*
|
|
99
|
+
* This can be a longer description of the action.
|
|
100
|
+
*/
|
|
101
|
+
caption?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The action display type.
|
|
104
|
+
*
|
|
105
|
+
* This will be used to modify the action button style.
|
|
106
|
+
*/
|
|
107
|
+
displayType?: ActionDisplayType;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Notification interface
|
|
111
|
+
*/
|
|
112
|
+
interface INotification<T extends ReadonlyJSONValue = ReadonlyJSONValue> {
|
|
113
|
+
/**
|
|
114
|
+
* Notification unique identifier
|
|
115
|
+
*/
|
|
116
|
+
id: string;
|
|
117
|
+
/**
|
|
118
|
+
* Notification message
|
|
119
|
+
*
|
|
120
|
+
* #### Notes
|
|
121
|
+
* The message will be truncated if longer than 140 characters.
|
|
122
|
+
*/
|
|
123
|
+
message: string;
|
|
124
|
+
/**
|
|
125
|
+
* Notification creation date
|
|
126
|
+
*/
|
|
127
|
+
createdAt: number;
|
|
128
|
+
/**
|
|
129
|
+
* Notification modification date
|
|
130
|
+
*/
|
|
131
|
+
modifiedAt: number;
|
|
132
|
+
/**
|
|
133
|
+
* Notification type
|
|
134
|
+
*/
|
|
135
|
+
type: TypeOptions;
|
|
136
|
+
/**
|
|
137
|
+
* Notification options
|
|
138
|
+
*/
|
|
139
|
+
options: IOptions<T>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Notification change interface
|
|
143
|
+
*/
|
|
144
|
+
interface IChange {
|
|
145
|
+
/**
|
|
146
|
+
* Change type
|
|
147
|
+
*/
|
|
148
|
+
type: 'added' | 'removed' | 'updated';
|
|
149
|
+
/**
|
|
150
|
+
* Notification that changed
|
|
151
|
+
*/
|
|
152
|
+
notification: INotification;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Notification options
|
|
156
|
+
*/
|
|
157
|
+
interface IOptions<T extends ReadonlyJSONValue> {
|
|
158
|
+
/**
|
|
159
|
+
* Autoclosing behavior - false (not closing automatically)
|
|
160
|
+
* or number (time in milliseconds before hiding the notification)
|
|
161
|
+
*
|
|
162
|
+
* Set to zero if you want the notification to be retained in the notification
|
|
163
|
+
* center but not displayed as toast. This is the default behavior.
|
|
164
|
+
*/
|
|
165
|
+
autoClose?: number | false;
|
|
166
|
+
/**
|
|
167
|
+
* List of associated actions
|
|
168
|
+
*/
|
|
169
|
+
actions?: Array<IAction>;
|
|
170
|
+
/**
|
|
171
|
+
* Data associated with a notification
|
|
172
|
+
*/
|
|
173
|
+
data?: T;
|
|
174
|
+
/**
|
|
175
|
+
* Task progression
|
|
176
|
+
*
|
|
177
|
+
* ### Notes
|
|
178
|
+
* This should be a number between 0 (not started) and 1 (completed).
|
|
179
|
+
*/
|
|
180
|
+
progress?: number;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Parameters for notification depending on a promise.
|
|
184
|
+
*/
|
|
185
|
+
interface IPromiseOptions<Pending extends ReadonlyJSONValue, Success extends ReadonlyJSONValue = Pending, Error extends ReadonlyJSONValue = Pending> {
|
|
186
|
+
/**
|
|
187
|
+
* Promise pending message and options
|
|
188
|
+
*
|
|
189
|
+
* #### Notes
|
|
190
|
+
* The message will be truncated if longer than 140 characters.
|
|
191
|
+
*/
|
|
192
|
+
pending: {
|
|
193
|
+
message: string;
|
|
194
|
+
options?: IOptions<Pending>;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Message when promise resolves and options
|
|
198
|
+
*
|
|
199
|
+
* The message factory receives as first argument the result
|
|
200
|
+
* of the promise and as second the success `options.data`.
|
|
201
|
+
*
|
|
202
|
+
* #### Notes
|
|
203
|
+
* The message will be truncated if longer than 140 characters.
|
|
204
|
+
*/
|
|
205
|
+
success: {
|
|
206
|
+
message: (result: unknown, data?: Success) => string;
|
|
207
|
+
options?: IOptions<Success>;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Message when promise rejects and options
|
|
211
|
+
*
|
|
212
|
+
* The message factory receives as first argument the error
|
|
213
|
+
* of the promise and as second the error `options.data`.
|
|
214
|
+
*
|
|
215
|
+
* #### Notes
|
|
216
|
+
* The message will be truncated if longer than 140 characters.
|
|
217
|
+
*/
|
|
218
|
+
error: {
|
|
219
|
+
message: (reason: unknown, data?: Error) => string;
|
|
220
|
+
options?: IOptions<Error>;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Type of notifications
|
|
225
|
+
*/
|
|
226
|
+
type TypeOptions = 'info' | 'in-progress' | 'success' | 'warning' | 'error' | 'default';
|
|
227
|
+
/**
|
|
228
|
+
* Options for updating a notification
|
|
229
|
+
*/
|
|
230
|
+
interface IUpdate<T extends ReadonlyJSONValue> extends IOptions<T> {
|
|
231
|
+
/**
|
|
232
|
+
* Notification unique id
|
|
233
|
+
*/
|
|
234
|
+
id: string;
|
|
235
|
+
/**
|
|
236
|
+
* New notification message
|
|
237
|
+
*/
|
|
238
|
+
message?: string;
|
|
239
|
+
/**
|
|
240
|
+
* New notification type
|
|
241
|
+
*/
|
|
242
|
+
type?: TypeOptions;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The global notification manager.
|
|
246
|
+
*/
|
|
247
|
+
const manager: NotificationManager;
|
|
248
|
+
/**
|
|
249
|
+
* Dismiss one notification (specified by its id) or all if no id provided
|
|
250
|
+
*
|
|
251
|
+
* @param id notification id
|
|
252
|
+
*/
|
|
253
|
+
function dismiss(id?: string): void;
|
|
254
|
+
/**
|
|
255
|
+
* Helper function to emit a notification.
|
|
256
|
+
*
|
|
257
|
+
* #### Notes
|
|
258
|
+
* The message will be truncated if longer than 140 characters.
|
|
259
|
+
*
|
|
260
|
+
* @param message Notification message
|
|
261
|
+
* @param type Notification type
|
|
262
|
+
* @param options Options for the error notification
|
|
263
|
+
* @returns Notification unique id
|
|
264
|
+
*/
|
|
265
|
+
function emit<T extends ReadonlyJSONValue = ReadonlyJSONValue>(message: string, type?: TypeOptions, options?: IOptions<T>): string;
|
|
266
|
+
/**
|
|
267
|
+
* Helper function to emit an error notification.
|
|
268
|
+
*
|
|
269
|
+
* #### Notes
|
|
270
|
+
* The message will be truncated if longer than 140 characters.
|
|
271
|
+
*
|
|
272
|
+
* @param message Notification message
|
|
273
|
+
* @param options Options for the error notification
|
|
274
|
+
* @returns Notification unique id
|
|
275
|
+
*/
|
|
276
|
+
function error<T extends ReadonlyJSONValue = ReadonlyJSONValue>(message: string, options?: IOptions<T>): string;
|
|
277
|
+
/**
|
|
278
|
+
* Helper function to emit an info notification.
|
|
279
|
+
*
|
|
280
|
+
* #### Notes
|
|
281
|
+
* The message will be truncated if longer than 140 characters.
|
|
282
|
+
*
|
|
283
|
+
* @param message Notification message
|
|
284
|
+
* @param options Options for the info notification
|
|
285
|
+
* @returns Notification unique id
|
|
286
|
+
*/
|
|
287
|
+
function info<T extends ReadonlyJSONValue = ReadonlyJSONValue>(message: string, options?: IOptions<T>): string;
|
|
288
|
+
/**
|
|
289
|
+
* Helper function to show an in-progress notification.
|
|
290
|
+
*
|
|
291
|
+
* #### Notes
|
|
292
|
+
* The message will be truncated if longer than 140 characters.
|
|
293
|
+
*
|
|
294
|
+
* @param promise Promise to wait for
|
|
295
|
+
* @param options Options for the in-progress notification
|
|
296
|
+
* @returns Notification unique id
|
|
297
|
+
*/
|
|
298
|
+
function promise<Pending extends ReadonlyJSONValue = ReadonlyJSONValue, Success extends ReadonlyJSONValue = Pending, Error extends ReadonlyJSONValue = Pending>(promise: Promise<Success>, options: IPromiseOptions<Pending, Success, Error>): string;
|
|
299
|
+
/**
|
|
300
|
+
* Helper function to emit a success notification.
|
|
301
|
+
*
|
|
302
|
+
* #### Notes
|
|
303
|
+
* The message will be truncated if longer than 140 characters.
|
|
304
|
+
*
|
|
305
|
+
* @param message Notification message
|
|
306
|
+
* @param options Options for the success notification
|
|
307
|
+
* @returns Notification unique id
|
|
308
|
+
*/
|
|
309
|
+
function success<T extends ReadonlyJSONValue = ReadonlyJSONValue>(message: string, options?: IOptions<T>): string;
|
|
310
|
+
/**
|
|
311
|
+
* Helper function to update a notification.
|
|
312
|
+
*
|
|
313
|
+
* If the notification does not exists, nothing will happen.
|
|
314
|
+
*
|
|
315
|
+
* Once updated the notification will be moved at the begin
|
|
316
|
+
* of the notification stack.
|
|
317
|
+
*
|
|
318
|
+
* #### Notes
|
|
319
|
+
* The message will be truncated if longer than 140 characters.
|
|
320
|
+
*
|
|
321
|
+
* @param args Update options
|
|
322
|
+
* @returns Whether the update was successful or not.
|
|
323
|
+
*/
|
|
324
|
+
function update<T extends ReadonlyJSONValue = ReadonlyJSONValue>(args: IUpdate<T>): boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Helper function to emit a warning notification.
|
|
327
|
+
*
|
|
328
|
+
* #### Notes
|
|
329
|
+
* The message will be truncated if longer than 140 characters.
|
|
330
|
+
*
|
|
331
|
+
* @param message Notification message
|
|
332
|
+
* @param options Options for the warning notification
|
|
333
|
+
* @returns Notification unique id
|
|
334
|
+
*/
|
|
335
|
+
function warning<T extends ReadonlyJSONValue = ReadonlyJSONValue>(message: string, options?: IOptions<T>): string;
|
|
336
|
+
}
|