@jupyterlab/launcher 4.0.0-alpha.1 → 4.0.0-alpha.12

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/index.d.ts CHANGED
@@ -2,170 +2,5 @@
2
2
  * @packageDocumentation
3
3
  * @module launcher
4
4
  */
5
- import { ITranslator } from '@jupyterlab/translation';
6
- import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
7
- import { IIterator } from '@lumino/algorithm';
8
- import { CommandRegistry } from '@lumino/commands';
9
- import { ReadonlyJSONObject, Token } from '@lumino/coreutils';
10
- import { IDisposable } from '@lumino/disposable';
11
- import { Widget } from '@lumino/widgets';
12
- import * as React from 'react';
13
- /**
14
- * The launcher token.
15
- */
16
- export declare const ILauncher: Token<ILauncher>;
17
- /**
18
- * The launcher interface.
19
- */
20
- export interface ILauncher {
21
- /**
22
- * Add a command item to the launcher, and trigger re-render event for parent
23
- * widget.
24
- *
25
- * @param options - The specification options for a launcher item.
26
- *
27
- * @returns A disposable that will remove the item from Launcher, and trigger
28
- * re-render event for parent widget.
29
- *
30
- */
31
- add(options: ILauncher.IItemOptions): IDisposable;
32
- }
33
- /**
34
- * LauncherModel keeps track of the path to working directory and has a list of
35
- * LauncherItems, which the Launcher will render.
36
- */
37
- export declare class LauncherModel extends VDomModel implements ILauncher {
38
- /**
39
- * Add a command item to the launcher, and trigger re-render event for parent
40
- * widget.
41
- *
42
- * @param options - The specification options for a launcher item.
43
- *
44
- * @returns A disposable that will remove the item from Launcher, and trigger
45
- * re-render event for parent widget.
46
- *
47
- */
48
- add(options: ILauncher.IItemOptions): IDisposable;
49
- /**
50
- * Return an iterator of launcher items.
51
- */
52
- items(): IIterator<ILauncher.IItemOptions>;
53
- private _items;
54
- }
55
- /**
56
- * A virtual-DOM-based widget for the Launcher.
57
- */
58
- export declare class Launcher extends VDomRenderer<LauncherModel> {
59
- /**
60
- * Construct a new launcher widget.
61
- */
62
- constructor(options: ILauncher.IOptions);
63
- /**
64
- * The cwd of the launcher.
65
- */
66
- get cwd(): string;
67
- set cwd(value: string);
68
- /**
69
- * Whether there is a pending item being launched.
70
- */
71
- get pending(): boolean;
72
- set pending(value: boolean);
73
- /**
74
- * Render the launcher to virtual DOM nodes.
75
- */
76
- protected render(): React.ReactElement<any> | null;
77
- protected translator: ITranslator;
78
- private _trans;
79
- private _commands;
80
- private _callback;
81
- private _pending;
82
- private _cwd;
83
- }
84
- /**
85
- * The namespace for `ILauncher` class statics.
86
- */
87
- export declare namespace ILauncher {
88
- /**
89
- * The options used to create a Launcher.
90
- */
91
- interface IOptions {
92
- /**
93
- * The model of the launcher.
94
- */
95
- model: LauncherModel;
96
- /**
97
- * The cwd of the launcher.
98
- */
99
- cwd: string;
100
- /**
101
- * The command registry used by the launcher.
102
- */
103
- commands: CommandRegistry;
104
- /**
105
- * The application language translation.
106
- */
107
- translator?: ITranslator;
108
- /**
109
- * The callback used when an item is launched.
110
- */
111
- callback: (widget: Widget) => void;
112
- }
113
- /**
114
- * The options used to create a launcher item.
115
- */
116
- interface IItemOptions {
117
- /**
118
- * The command ID for the launcher item.
119
- *
120
- * #### Notes
121
- * If the command's `execute` method returns a `Widget` or
122
- * a promise that resolves with a `Widget`, then that widget will
123
- * replace the launcher in the same location of the application
124
- * shell. If the `execute` method does something else
125
- * (i.e., create a modal dialog), then the launcher will not be
126
- * disposed.
127
- */
128
- command: string;
129
- /**
130
- * The arguments given to the command for
131
- * creating the launcher item.
132
- *
133
- * ### Notes
134
- * The launcher will also add the current working
135
- * directory of the filebrowser in the `cwd` field
136
- * of the args, which a command may use to create
137
- * the activity with respect to the right directory.
138
- */
139
- args?: ReadonlyJSONObject;
140
- /**
141
- * The category for the launcher item.
142
- *
143
- * The default value is an empty string.
144
- */
145
- category?: string;
146
- /**
147
- * The rank for the launcher item.
148
- *
149
- * The rank is used when ordering launcher items for display. After grouping
150
- * into categories, items are sorted in the following order:
151
- * 1. Rank (lower is better)
152
- * 3. Display Name (locale order)
153
- *
154
- * The default rank is `Infinity`.
155
- */
156
- rank?: number;
157
- /**
158
- * For items that have a kernel associated with them, the URL of the kernel
159
- * icon.
160
- *
161
- * This is not a CSS class, but the URL that points to the icon in the kernel
162
- * spec.
163
- */
164
- kernelIconUrl?: string;
165
- /**
166
- * Metadata about the item. This can be used by the launcher to
167
- * affect how the item is displayed.
168
- */
169
- metadata?: ReadonlyJSONObject;
170
- }
171
- }
5
+ export * from './tokens';
6
+ export * from './widget';
package/lib/index.js CHANGED
@@ -4,273 +4,6 @@
4
4
  * @packageDocumentation
5
5
  * @module launcher
6
6
  */
7
- import { showErrorMessage } from '@jupyterlab/apputils';
8
- import { nullTranslator } from '@jupyterlab/translation';
9
- import { classes, LabIcon, VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
10
- import { ArrayExt, ArrayIterator, each, map, toArray } from '@lumino/algorithm';
11
- import { Token } from '@lumino/coreutils';
12
- import { DisposableDelegate } from '@lumino/disposable';
13
- import { AttachedProperty } from '@lumino/properties';
14
- import { Widget } from '@lumino/widgets';
15
- import * as React from 'react';
16
- /**
17
- * The class name added to Launcher instances.
18
- */
19
- const LAUNCHER_CLASS = 'jp-Launcher';
20
- /* tslint:disable */
21
- /**
22
- * The launcher token.
23
- */
24
- export const ILauncher = new Token('@jupyterlab/launcher:ILauncher');
25
- /**
26
- * LauncherModel keeps track of the path to working directory and has a list of
27
- * LauncherItems, which the Launcher will render.
28
- */
29
- export class LauncherModel extends VDomModel {
30
- constructor() {
31
- super(...arguments);
32
- this._items = [];
33
- }
34
- /**
35
- * Add a command item to the launcher, and trigger re-render event for parent
36
- * widget.
37
- *
38
- * @param options - The specification options for a launcher item.
39
- *
40
- * @returns A disposable that will remove the item from Launcher, and trigger
41
- * re-render event for parent widget.
42
- *
43
- */
44
- add(options) {
45
- // Create a copy of the options to circumvent mutations to the original.
46
- const item = Private.createItem(options);
47
- this._items.push(item);
48
- this.stateChanged.emit(void 0);
49
- return new DisposableDelegate(() => {
50
- ArrayExt.removeFirstOf(this._items, item);
51
- this.stateChanged.emit(void 0);
52
- });
53
- }
54
- /**
55
- * Return an iterator of launcher items.
56
- */
57
- items() {
58
- return new ArrayIterator(this._items);
59
- }
60
- }
61
- /**
62
- * A virtual-DOM-based widget for the Launcher.
63
- */
64
- export class Launcher extends VDomRenderer {
65
- /**
66
- * Construct a new launcher widget.
67
- */
68
- constructor(options) {
69
- super(options.model);
70
- this._pending = false;
71
- this._cwd = '';
72
- this._cwd = options.cwd;
73
- this.translator = options.translator || nullTranslator;
74
- this._trans = this.translator.load('jupyterlab');
75
- this._callback = options.callback;
76
- this._commands = options.commands;
77
- this.addClass(LAUNCHER_CLASS);
78
- }
79
- /**
80
- * The cwd of the launcher.
81
- */
82
- get cwd() {
83
- return this._cwd;
84
- }
85
- set cwd(value) {
86
- this._cwd = value;
87
- this.update();
88
- }
89
- /**
90
- * Whether there is a pending item being launched.
91
- */
92
- get pending() {
93
- return this._pending;
94
- }
95
- set pending(value) {
96
- this._pending = value;
97
- }
98
- /**
99
- * Render the launcher to virtual DOM nodes.
100
- */
101
- render() {
102
- // Bail if there is no model.
103
- if (!this.model) {
104
- return null;
105
- }
106
- const knownCategories = [
107
- this._trans.__('Notebook'),
108
- this._trans.__('Console'),
109
- this._trans.__('Other')
110
- ];
111
- const kernelCategories = [
112
- this._trans.__('Notebook'),
113
- this._trans.__('Console')
114
- ];
115
- // First group-by categories
116
- const categories = Object.create(null);
117
- each(this.model.items(), (item, index) => {
118
- const cat = item.category || this._trans.__('Other');
119
- if (!(cat in categories)) {
120
- categories[cat] = [];
121
- }
122
- categories[cat].push(item);
123
- });
124
- // Within each category sort by rank
125
- for (const cat in categories) {
126
- categories[cat] = categories[cat].sort((a, b) => {
127
- return Private.sortCmp(a, b, this._cwd, this._commands);
128
- });
129
- }
130
- // Variable to help create sections
131
- const sections = [];
132
- let section;
133
- // Assemble the final ordered list of categories, beginning with
134
- // KNOWN_CATEGORIES.
135
- const orderedCategories = [];
136
- each(knownCategories, (cat, index) => {
137
- orderedCategories.push(cat);
138
- });
139
- for (const cat in categories) {
140
- if (knownCategories.indexOf(cat) === -1) {
141
- orderedCategories.push(cat);
142
- }
143
- }
144
- // Now create the sections for each category
145
- orderedCategories.forEach(cat => {
146
- if (!categories[cat]) {
147
- return;
148
- }
149
- const item = categories[cat][0];
150
- const args = Object.assign(Object.assign({}, item.args), { cwd: this.cwd });
151
- const kernel = kernelCategories.indexOf(cat) > -1;
152
- // DEPRECATED: remove _icon when lumino 2.0 is adopted
153
- // if icon is aliasing iconClass, don't use it
154
- const iconClass = this._commands.iconClass(item.command, args);
155
- const _icon = this._commands.icon(item.command, args);
156
- const icon = _icon === iconClass ? undefined : _icon;
157
- if (cat in categories) {
158
- section = (React.createElement("div", { className: "jp-Launcher-section", key: cat },
159
- React.createElement("div", { className: "jp-Launcher-sectionHeader" },
160
- React.createElement(LabIcon.resolveReact, { icon: icon, iconClass: classes(iconClass, 'jp-Icon-cover'), stylesheet: "launcherSection" }),
161
- React.createElement("h2", { className: "jp-Launcher-sectionTitle" }, cat)),
162
- React.createElement("div", { className: "jp-Launcher-cardContainer" }, toArray(map(categories[cat], (item) => {
163
- return Card(kernel, item, this, this._commands, this._trans, this._callback);
164
- })))));
165
- sections.push(section);
166
- }
167
- });
168
- // Wrap the sections in body and content divs.
169
- return (React.createElement("div", { className: "jp-Launcher-body" },
170
- React.createElement("div", { className: "jp-Launcher-content" },
171
- React.createElement("div", { className: "jp-Launcher-cwd" },
172
- React.createElement("h3", null, this.cwd)),
173
- sections)));
174
- }
175
- }
176
- /**
177
- * A pure tsx component for a launcher card.
178
- *
179
- * @param kernel - whether the item takes uses a kernel.
180
- *
181
- * @param item - the launcher item to render.
182
- *
183
- * @param launcher - the Launcher instance to which this is added.
184
- *
185
- * @param launcherCallback - a callback to call after an item has been launched.
186
- *
187
- * @returns a vdom `VirtualElement` for the launcher card.
188
- */
189
- function Card(kernel, item, launcher, commands, trans, launcherCallback) {
190
- // Get some properties of the command
191
- const command = item.command;
192
- const args = Object.assign(Object.assign({}, item.args), { cwd: launcher.cwd });
193
- const caption = commands.caption(command, args);
194
- const label = commands.label(command, args);
195
- const title = kernel ? label : caption || label;
196
- // Build the onclick handler.
197
- const onclick = () => {
198
- // If an item has already been launched,
199
- // don't try to launch another.
200
- if (launcher.pending === true) {
201
- return;
202
- }
203
- launcher.pending = true;
204
- void commands
205
- .execute(command, Object.assign(Object.assign({}, item.args), { cwd: launcher.cwd }))
206
- .then(value => {
207
- launcher.pending = false;
208
- if (value instanceof Widget) {
209
- launcherCallback(value);
210
- launcher.dispose();
211
- }
212
- })
213
- .catch(err => {
214
- launcher.pending = false;
215
- void showErrorMessage(trans._p('Error', 'Launcher Error'), err);
216
- });
217
- };
218
- // With tabindex working, you can now pick a kernel by tabbing around and
219
- // pressing Enter.
220
- const onkeypress = (event) => {
221
- if (event.key === 'Enter') {
222
- onclick();
223
- }
224
- };
225
- // DEPRECATED: remove _icon when lumino 2.0 is adopted
226
- // if icon is aliasing iconClass, don't use it
227
- const iconClass = commands.iconClass(command, args);
228
- const _icon = commands.icon(command, args);
229
- const icon = _icon === iconClass ? undefined : _icon;
230
- // Return the VDOM element.
231
- return (React.createElement("div", { className: "jp-LauncherCard", title: title, onClick: onclick, onKeyPress: onkeypress, tabIndex: 0, "data-category": item.category || trans.__('Other'), key: Private.keyProperty.get(item) },
232
- React.createElement("div", { className: "jp-LauncherCard-icon" }, kernel ? (item.kernelIconUrl ? (React.createElement("img", { src: item.kernelIconUrl, className: "jp-Launcher-kernelIcon" })) : (React.createElement("div", { className: "jp-LauncherCard-noKernelIcon" }, label[0].toUpperCase()))) : (React.createElement(LabIcon.resolveReact, { icon: icon, iconClass: classes(iconClass, 'jp-Icon-cover'), stylesheet: "launcherCard" }))),
233
- React.createElement("div", { className: "jp-LauncherCard-label", title: title },
234
- React.createElement("p", null, label))));
235
- }
236
- /**
237
- * The namespace for module private data.
238
- */
239
- var Private;
240
- (function (Private) {
241
- /**
242
- * An incrementing counter for keys.
243
- */
244
- let id = 0;
245
- /**
246
- * An attached property for an item's key.
247
- */
248
- Private.keyProperty = new AttachedProperty({
249
- name: 'key',
250
- create: () => id++
251
- });
252
- /**
253
- * Create a fully specified item given item options.
254
- */
255
- function createItem(options) {
256
- return Object.assign(Object.assign({}, options), { category: options.category || '', rank: options.rank !== undefined ? options.rank : Infinity });
257
- }
258
- Private.createItem = createItem;
259
- /**
260
- * A sort comparison function for a launcher item.
261
- */
262
- function sortCmp(a, b, cwd, commands) {
263
- // First, compare by rank.
264
- const r1 = a.rank;
265
- const r2 = b.rank;
266
- if (r1 !== r2 && r1 !== undefined && r2 !== undefined) {
267
- return r1 < r2 ? -1 : 1; // Infinity safe
268
- }
269
- // Finally, compare by display name.
270
- const aLabel = commands.label(a.command, Object.assign(Object.assign({}, a.args), { cwd }));
271
- const bLabel = commands.label(b.command, Object.assign(Object.assign({}, b.args), { cwd }));
272
- return aLabel.localeCompare(bLabel);
273
- }
274
- Private.sortCmp = sortCmp;
275
- })(Private || (Private = {}));
7
+ export * from './tokens';
8
+ export * from './widget';
276
9
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,YAAY,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,IAAI,EAEJ,GAAG,EACH,OAAO,EACR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAsB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAe,MAAM,oBAAoB,CAAC;AACrE,OAA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AAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,SAAS,EAAE;YACrD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB;SAC1C;QAED,oCAAoC;QACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,kCAAO,CAAC,CAAC,IAAI,KAAE,GAAG,IAAG,CAAC;QAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,kCAAO,CAAC,CAAC,IAAI,KAAE,GAAG,IAAG,CAAC;QAC7D,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAjBe,eAAO,UAiBtB,CAAA;AACH,CAAC,EAnDS,OAAO,KAAP,OAAO,QAmDhB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,124 @@
1
+ import { ITranslator } from '@jupyterlab/translation';
2
+ import { VDomRenderer } from '@jupyterlab/ui-components';
3
+ import { IIterator } from '@lumino/algorithm';
4
+ import { CommandRegistry } from '@lumino/commands';
5
+ import { ReadonlyJSONObject, Token } from '@lumino/coreutils';
6
+ import { IDisposable } from '@lumino/disposable';
7
+ import { Widget } from '@lumino/widgets';
8
+ /**
9
+ * The launcher token.
10
+ */
11
+ export declare const ILauncher: Token<ILauncher>;
12
+ /**
13
+ * The launcher interface.
14
+ */
15
+ export interface ILauncher {
16
+ /**
17
+ * Add a command item to the launcher, and trigger re-render event for parent
18
+ * widget.
19
+ *
20
+ * @param options - The specification options for a launcher item.
21
+ *
22
+ * @returns A disposable that will remove the item from Launcher, and trigger
23
+ * re-render event for parent widget.
24
+ *
25
+ */
26
+ add(options: ILauncher.IItemOptions): IDisposable;
27
+ }
28
+ /**
29
+ * The namespace for `ILauncher` class statics.
30
+ */
31
+ export declare namespace ILauncher {
32
+ /**
33
+ * An interface for the launcher model
34
+ */
35
+ interface IModel extends ILauncher, VDomRenderer.IModel {
36
+ /**
37
+ * Return an iterator of launcher items.
38
+ */
39
+ items(): IIterator<ILauncher.IItemOptions>;
40
+ }
41
+ /**
42
+ * The options used to create a Launcher.
43
+ */
44
+ interface IOptions {
45
+ /**
46
+ * The model of the launcher.
47
+ */
48
+ model: IModel;
49
+ /**
50
+ * The cwd of the launcher.
51
+ */
52
+ cwd: string;
53
+ /**
54
+ * The command registry used by the launcher.
55
+ */
56
+ commands: CommandRegistry;
57
+ /**
58
+ * The application language translation.
59
+ */
60
+ translator?: ITranslator;
61
+ /**
62
+ * The callback used when an item is launched.
63
+ */
64
+ callback: (widget: Widget) => void;
65
+ }
66
+ /**
67
+ * The options used to create a launcher item.
68
+ */
69
+ interface IItemOptions {
70
+ /**
71
+ * The command ID for the launcher item.
72
+ *
73
+ * #### Notes
74
+ * If the command's `execute` method returns a `Widget` or
75
+ * a promise that resolves with a `Widget`, then that widget will
76
+ * replace the launcher in the same location of the application
77
+ * shell. If the `execute` method does something else
78
+ * (i.e., create a modal dialog), then the launcher will not be
79
+ * disposed.
80
+ */
81
+ command: string;
82
+ /**
83
+ * The arguments given to the command for
84
+ * creating the launcher item.
85
+ *
86
+ * ### Notes
87
+ * The launcher will also add the current working
88
+ * directory of the filebrowser in the `cwd` field
89
+ * of the args, which a command may use to create
90
+ * the activity with respect to the right directory.
91
+ */
92
+ args?: ReadonlyJSONObject;
93
+ /**
94
+ * The category for the launcher item.
95
+ *
96
+ * The default value is an empty string.
97
+ */
98
+ category?: string;
99
+ /**
100
+ * The rank for the launcher item.
101
+ *
102
+ * The rank is used when ordering launcher items for display. After grouping
103
+ * into categories, items are sorted in the following order:
104
+ * 1. Rank (lower is better)
105
+ * 3. Display Name (locale order)
106
+ *
107
+ * The default rank is `Infinity`.
108
+ */
109
+ rank?: number;
110
+ /**
111
+ * For items that have a kernel associated with them, the URL of the kernel
112
+ * icon.
113
+ *
114
+ * This is not a CSS class, but the URL that points to the icon in the kernel
115
+ * spec.
116
+ */
117
+ kernelIconUrl?: string;
118
+ /**
119
+ * Metadata about the item. This can be used by the launcher to
120
+ * affect how the item is displayed.
121
+ */
122
+ metadata?: ReadonlyJSONObject;
123
+ }
124
+ }
package/lib/tokens.js ADDED
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright (c) Jupyter Development Team.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ import { Token } from '@lumino/coreutils';
6
+ /**
7
+ * The launcher token.
8
+ */
9
+ export const ILauncher = new Token('@jupyterlab/launcher:ILauncher');
10
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAsB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI9D;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,KAAK,CAAY,gCAAgC,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { ITranslator } from '@jupyterlab/translation';
2
+ import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
3
+ import { IIterator } from '@lumino/algorithm';
4
+ import { IDisposable } from '@lumino/disposable';
5
+ import * as React from 'react';
6
+ import { ILauncher } from './tokens';
7
+ /**
8
+ * LauncherModel keeps track of the path to working directory and has a list of
9
+ * LauncherItems, which the Launcher will render.
10
+ */
11
+ export declare class LauncherModel extends VDomModel implements ILauncher.IModel {
12
+ /**
13
+ * Add a command item to the launcher, and trigger re-render event for parent
14
+ * widget.
15
+ *
16
+ * @param options - The specification options for a launcher item.
17
+ *
18
+ * @returns A disposable that will remove the item from Launcher, and trigger
19
+ * re-render event for parent widget.
20
+ *
21
+ */
22
+ add(options: ILauncher.IItemOptions): IDisposable;
23
+ /**
24
+ * Return an iterator of launcher items.
25
+ */
26
+ items(): IIterator<ILauncher.IItemOptions>;
27
+ protected itemsList: ILauncher.IItemOptions[];
28
+ }
29
+ /**
30
+ * A virtual-DOM-based widget for the Launcher.
31
+ */
32
+ export declare class Launcher extends VDomRenderer<ILauncher.IModel> {
33
+ /**
34
+ * Construct a new launcher widget.
35
+ */
36
+ constructor(options: ILauncher.IOptions);
37
+ /**
38
+ * The cwd of the launcher.
39
+ */
40
+ get cwd(): string;
41
+ set cwd(value: string);
42
+ /**
43
+ * Whether there is a pending item being launched.
44
+ */
45
+ get pending(): boolean;
46
+ set pending(value: boolean);
47
+ /**
48
+ * Render the launcher to virtual DOM nodes.
49
+ */
50
+ protected render(): React.ReactElement<any> | null;
51
+ protected translator: ITranslator;
52
+ private _trans;
53
+ private _commands;
54
+ private _callback;
55
+ private _pending;
56
+ private _cwd;
57
+ }
package/lib/widget.js ADDED
@@ -0,0 +1,268 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { showErrorMessage } from '@jupyterlab/apputils';
4
+ import { nullTranslator } from '@jupyterlab/translation';
5
+ import { classes, LabIcon, VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
6
+ import { ArrayExt, ArrayIterator, each, map, toArray } from '@lumino/algorithm';
7
+ import { DisposableDelegate } from '@lumino/disposable';
8
+ import { AttachedProperty } from '@lumino/properties';
9
+ import { Widget } from '@lumino/widgets';
10
+ import * as React from 'react';
11
+ /**
12
+ * The class name added to Launcher instances.
13
+ */
14
+ const LAUNCHER_CLASS = 'jp-Launcher';
15
+ /**
16
+ * LauncherModel keeps track of the path to working directory and has a list of
17
+ * LauncherItems, which the Launcher will render.
18
+ */
19
+ export class LauncherModel extends VDomModel {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.itemsList = [];
23
+ }
24
+ /**
25
+ * Add a command item to the launcher, and trigger re-render event for parent
26
+ * widget.
27
+ *
28
+ * @param options - The specification options for a launcher item.
29
+ *
30
+ * @returns A disposable that will remove the item from Launcher, and trigger
31
+ * re-render event for parent widget.
32
+ *
33
+ */
34
+ add(options) {
35
+ // Create a copy of the options to circumvent mutations to the original.
36
+ const item = Private.createItem(options);
37
+ this.itemsList.push(item);
38
+ this.stateChanged.emit(void 0);
39
+ return new DisposableDelegate(() => {
40
+ ArrayExt.removeFirstOf(this.itemsList, item);
41
+ this.stateChanged.emit(void 0);
42
+ });
43
+ }
44
+ /**
45
+ * Return an iterator of launcher items.
46
+ */
47
+ items() {
48
+ return new ArrayIterator(this.itemsList);
49
+ }
50
+ }
51
+ /**
52
+ * A virtual-DOM-based widget for the Launcher.
53
+ */
54
+ export class Launcher extends VDomRenderer {
55
+ /**
56
+ * Construct a new launcher widget.
57
+ */
58
+ constructor(options) {
59
+ super(options.model);
60
+ this._pending = false;
61
+ this._cwd = '';
62
+ this._cwd = options.cwd;
63
+ this.translator = options.translator || nullTranslator;
64
+ this._trans = this.translator.load('jupyterlab');
65
+ this._callback = options.callback;
66
+ this._commands = options.commands;
67
+ this.addClass(LAUNCHER_CLASS);
68
+ }
69
+ /**
70
+ * The cwd of the launcher.
71
+ */
72
+ get cwd() {
73
+ return this._cwd;
74
+ }
75
+ set cwd(value) {
76
+ this._cwd = value;
77
+ this.update();
78
+ }
79
+ /**
80
+ * Whether there is a pending item being launched.
81
+ */
82
+ get pending() {
83
+ return this._pending;
84
+ }
85
+ set pending(value) {
86
+ this._pending = value;
87
+ }
88
+ /**
89
+ * Render the launcher to virtual DOM nodes.
90
+ */
91
+ render() {
92
+ // Bail if there is no model.
93
+ if (!this.model) {
94
+ return null;
95
+ }
96
+ const knownCategories = [
97
+ this._trans.__('Notebook'),
98
+ this._trans.__('Console'),
99
+ this._trans.__('Other')
100
+ ];
101
+ const kernelCategories = [
102
+ this._trans.__('Notebook'),
103
+ this._trans.__('Console')
104
+ ];
105
+ // First group-by categories
106
+ const categories = Object.create(null);
107
+ each(this.model.items(), (item, index) => {
108
+ const cat = item.category || this._trans.__('Other');
109
+ if (!(cat in categories)) {
110
+ categories[cat] = [];
111
+ }
112
+ categories[cat].push(item);
113
+ });
114
+ // Within each category sort by rank
115
+ for (const cat in categories) {
116
+ categories[cat] = categories[cat].sort((a, b) => {
117
+ return Private.sortCmp(a, b, this._cwd, this._commands);
118
+ });
119
+ }
120
+ // Variable to help create sections
121
+ const sections = [];
122
+ let section;
123
+ // Assemble the final ordered list of categories, beginning with
124
+ // KNOWN_CATEGORIES.
125
+ const orderedCategories = [];
126
+ each(knownCategories, (cat, index) => {
127
+ orderedCategories.push(cat);
128
+ });
129
+ for (const cat in categories) {
130
+ if (knownCategories.indexOf(cat) === -1) {
131
+ orderedCategories.push(cat);
132
+ }
133
+ }
134
+ // Now create the sections for each category
135
+ orderedCategories.forEach(cat => {
136
+ if (!categories[cat]) {
137
+ return;
138
+ }
139
+ const item = categories[cat][0];
140
+ const args = Object.assign(Object.assign({}, item.args), { cwd: this.cwd });
141
+ const kernel = kernelCategories.indexOf(cat) > -1;
142
+ // DEPRECATED: remove _icon when lumino 2.0 is adopted
143
+ // if icon is aliasing iconClass, don't use it
144
+ const iconClass = this._commands.iconClass(item.command, args);
145
+ const _icon = this._commands.icon(item.command, args);
146
+ const icon = _icon === iconClass ? undefined : _icon;
147
+ if (cat in categories) {
148
+ section = (React.createElement("div", { className: "jp-Launcher-section", key: cat },
149
+ React.createElement("div", { className: "jp-Launcher-sectionHeader" },
150
+ React.createElement(LabIcon.resolveReact, { icon: icon, iconClass: classes(iconClass, 'jp-Icon-cover'), stylesheet: "launcherSection" }),
151
+ React.createElement("h2", { className: "jp-Launcher-sectionTitle" }, cat)),
152
+ React.createElement("div", { className: "jp-Launcher-cardContainer" }, toArray(map(categories[cat], (item) => {
153
+ return Card(kernel, item, this, this._commands, this._trans, this._callback);
154
+ })))));
155
+ sections.push(section);
156
+ }
157
+ });
158
+ // Wrap the sections in body and content divs.
159
+ return (React.createElement("div", { className: "jp-Launcher-body" },
160
+ React.createElement("div", { className: "jp-Launcher-content" },
161
+ React.createElement("div", { className: "jp-Launcher-cwd" },
162
+ React.createElement("h3", null, this.cwd)),
163
+ sections)));
164
+ }
165
+ }
166
+ /**
167
+ * A pure tsx component for a launcher card.
168
+ *
169
+ * @param kernel - whether the item takes uses a kernel.
170
+ *
171
+ * @param item - the launcher item to render.
172
+ *
173
+ * @param launcher - the Launcher instance to which this is added.
174
+ *
175
+ * @param commands - the command registry holding the command of item.
176
+ *
177
+ * @param trans - the translation bundle.
178
+ *
179
+ * @returns a vdom `VirtualElement` for the launcher card.
180
+ */
181
+ function Card(kernel, item, launcher, commands, trans, launcherCallback) {
182
+ // Get some properties of the command
183
+ const command = item.command;
184
+ const args = Object.assign(Object.assign({}, item.args), { cwd: launcher.cwd });
185
+ const caption = commands.caption(command, args);
186
+ const label = commands.label(command, args);
187
+ const title = kernel ? label : caption || label;
188
+ // Build the onclick handler.
189
+ const onclick = () => {
190
+ // If an item has already been launched,
191
+ // don't try to launch another.
192
+ if (launcher.pending === true) {
193
+ return;
194
+ }
195
+ launcher.pending = true;
196
+ void commands
197
+ .execute(command, Object.assign(Object.assign({}, item.args), { cwd: launcher.cwd }))
198
+ .then(value => {
199
+ launcher.pending = false;
200
+ if (value instanceof Widget) {
201
+ launcherCallback(value);
202
+ }
203
+ })
204
+ .catch(err => {
205
+ console.error(err);
206
+ launcher.pending = false;
207
+ void showErrorMessage(trans._p('Error', 'Launcher Error'), err);
208
+ });
209
+ };
210
+ // With tabindex working, you can now pick a kernel by tabbing around and
211
+ // pressing Enter.
212
+ const onkeypress = (event) => {
213
+ if (event.key === 'Enter') {
214
+ onclick();
215
+ }
216
+ };
217
+ // DEPRECATED: remove _icon when lumino 2.0 is adopted
218
+ // if icon is aliasing iconClass, don't use it
219
+ const iconClass = commands.iconClass(command, args);
220
+ const _icon = commands.icon(command, args);
221
+ const icon = _icon === iconClass ? undefined : _icon;
222
+ // Return the VDOM element.
223
+ return (React.createElement("div", { className: "jp-LauncherCard", title: title, onClick: onclick, onKeyPress: onkeypress, tabIndex: 0, "data-category": item.category || trans.__('Other'), key: Private.keyProperty.get(item) },
224
+ React.createElement("div", { className: "jp-LauncherCard-icon" }, kernel ? (item.kernelIconUrl ? (React.createElement("img", { src: item.kernelIconUrl, className: "jp-Launcher-kernelIcon" })) : (React.createElement("div", { className: "jp-LauncherCard-noKernelIcon" }, label[0].toUpperCase()))) : (React.createElement(LabIcon.resolveReact, { icon: icon, iconClass: classes(iconClass, 'jp-Icon-cover'), stylesheet: "launcherCard" }))),
225
+ React.createElement("div", { className: "jp-LauncherCard-label", title: title },
226
+ React.createElement("p", null, label))));
227
+ }
228
+ /**
229
+ * The namespace for module private data.
230
+ */
231
+ var Private;
232
+ (function (Private) {
233
+ /**
234
+ * An incrementing counter for keys.
235
+ */
236
+ let id = 0;
237
+ /**
238
+ * An attached property for an item's key.
239
+ */
240
+ Private.keyProperty = new AttachedProperty({
241
+ name: 'key',
242
+ create: () => id++
243
+ });
244
+ /**
245
+ * Create a fully specified item given item options.
246
+ */
247
+ function createItem(options) {
248
+ return Object.assign(Object.assign({}, options), { category: options.category || '', rank: options.rank !== undefined ? options.rank : Infinity });
249
+ }
250
+ Private.createItem = createItem;
251
+ /**
252
+ * A sort comparison function for a launcher item.
253
+ */
254
+ function sortCmp(a, b, cwd, commands) {
255
+ // First, compare by rank.
256
+ const r1 = a.rank;
257
+ const r2 = b.rank;
258
+ if (r1 !== r2 && r1 !== undefined && r2 !== undefined) {
259
+ return r1 < r2 ? -1 : 1; // Infinity safe
260
+ }
261
+ // Finally, compare by display name.
262
+ const aLabel = commands.label(a.command, Object.assign(Object.assign({}, a.args), { cwd }));
263
+ const bLabel = commands.label(b.command, Object.assign(Object.assign({}, b.args), { cwd }));
264
+ return aLabel.localeCompare(bLabel);
265
+ }
266
+ Private.sortCmp = sortCmp;
267
+ })(Private || (Private = {}));
268
+ //# sourceMappingURL=widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAC1D;IACJ,CAAC;IARe,kBAAU,aAQzB,CAAA;IAED;;OAEG;IACH,SAAgB,OAAO,CACrB,CAAyB,EACzB,CAAyB,EACzB,GAAW,EACX,QAAyB;QAEzB,0BAA0B;QAC1B,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QAClB,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QAClB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,SAAS,EAAE;YACrD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB;SAC1C;QAED,oCAAoC;QACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,kCAAO,CAAC,CAAC,IAAI,KAAE,GAAG,IAAG,CAAC;QAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,kCAAO,CAAC,CAAC,IAAI,KAAE,GAAG,IAAG,CAAC;QAC7D,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAjBe,eAAO,UAiBtB,CAAA;AACH,CAAC,EAnDS,OAAO,KAAP,OAAO,QAmDhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/launcher",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.12",
4
4
  "description": "JupyterLab - Launcher Panel",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -36,22 +36,22 @@
36
36
  "watch": "tsc -b --watch"
37
37
  },
38
38
  "dependencies": {
39
- "@jupyterlab/apputils": "^4.0.0-alpha.1",
40
- "@jupyterlab/translation": "^4.0.0-alpha.1",
41
- "@jupyterlab/ui-components": "^4.0.0-alpha.16",
39
+ "@jupyterlab/apputils": "^4.0.0-alpha.12",
40
+ "@jupyterlab/translation": "^4.0.0-alpha.12",
41
+ "@jupyterlab/ui-components": "^4.0.0-alpha.27",
42
42
  "@lumino/algorithm": "^1.9.1",
43
- "@lumino/commands": "^1.19.0",
44
- "@lumino/coreutils": "^1.11.1",
43
+ "@lumino/commands": "^1.20.0",
44
+ "@lumino/coreutils": "^1.12.0",
45
45
  "@lumino/disposable": "^1.10.1",
46
46
  "@lumino/properties": "^1.8.1",
47
- "@lumino/widgets": "^1.30.0",
47
+ "@lumino/widgets": "^1.33.0",
48
48
  "react": "^17.0.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/react": "^17.0.0",
52
52
  "rimraf": "~3.0.0",
53
- "typedoc": "~0.21.2",
54
- "typescript": "~4.1.3"
53
+ "typedoc": "~0.22.10",
54
+ "typescript": "~4.7.3"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
package/style/base.css CHANGED
@@ -25,6 +25,7 @@
25
25
  box-sizing: border-box;
26
26
  min-width: 120px;
27
27
  min-height: 120px;
28
+
28
29
  /* This is needed so that all font sizing of children done in ems is
29
30
  * relative to this base size */
30
31
  font-size: var(--jp-ui-font-size1);
@@ -43,7 +44,7 @@
43
44
  font-size: var(--jp-ui-font-size2);
44
45
  font-weight: normal;
45
46
  color: var(--jp-ui-font-color1);
46
- margin: 1em 0px;
47
+ margin: 1em 0;
47
48
  }
48
49
 
49
50
  .jp-Launcher-content {
@@ -68,10 +69,11 @@
68
69
  flex-direction: row;
69
70
  align-items: center;
70
71
  box-sizing: border-box;
72
+
71
73
  /* This is custom tuned to get the section header to align with the cards */
72
74
  margin-left: 5px;
73
75
  border-bottom: 1px solid var(--jp-border-color2);
74
- padding-bottom: 0px;
76
+ padding-bottom: 0;
75
77
  margin-bottom: 8px;
76
78
  }
77
79
 
@@ -100,7 +102,7 @@
100
102
  width: var(--jp-private-launcher-card-size);
101
103
  height: var(--jp-private-launcher-card-size);
102
104
  margin: 8px;
103
- padding: 0px;
105
+ padding: 0;
104
106
  border: 1px solid var(--jp-border-color2);
105
107
  background: var(--jp-layout-color0);
106
108
  box-shadow: var(--jp-elevation-z2);
@@ -126,8 +128,8 @@
126
128
  width: 100%;
127
129
  height: var(--jp-private-launcher-card-icon-height);
128
130
  box-sizing: border-box;
129
- margin: 0px;
130
- padding: 0px;
131
+ margin: 0;
132
+ padding: 0;
131
133
  display: flex;
132
134
  justify-content: center;
133
135
  align-items: center;
@@ -151,7 +153,7 @@
151
153
  .jp-LauncherCard-label {
152
154
  width: 100%;
153
155
  height: var(--jp-private-launcher-card-label-height);
154
- padding: 0 4px 4px 4px;
156
+ padding: 0 4px 4px;
155
157
  box-sizing: border-box;
156
158
  overflow: hidden;
157
159
  }
@@ -164,6 +166,7 @@
164
166
  line-height: 14px;
165
167
  font-size: 12px;
166
168
  overflow: hidden;
169
+ margin: auto;
167
170
  }
168
171
 
169
172
  /* kernel icons */
@@ -171,6 +174,6 @@
171
174
  .jp-Launcher-kernelIcon {
172
175
  width: var(--jp-private-launcher-large-icon-size);
173
176
  height: var(--jp-private-launcher-large-icon-size);
174
- margin: 0px;
175
- padding: 0px;
177
+ margin: 0;
178
+ padding: 0;
176
179
  }