@jupyterlab/application 4.2.0-alpha.2 → 4.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/frontend.d.ts +14 -1
- package/lib/frontend.js.map +1 -1
- package/lib/utils.d.ts +53 -2
- package/lib/utils.js +44 -0
- package/lib/utils.js.map +1 -1
- package/package.json +14 -14
- package/src/frontend.ts +18 -1
- package/src/utils.ts +108 -3
- package/style/sidepanel.css +5 -0
package/lib/frontend.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ContextMenuSvg } from '@jupyterlab/ui-components';
|
|
|
5
5
|
import { Application, IPlugin } from '@lumino/application';
|
|
6
6
|
import { Token } from '@lumino/coreutils';
|
|
7
7
|
import { ISignal } from '@lumino/signaling';
|
|
8
|
-
import { Widget } from '@lumino/widgets';
|
|
8
|
+
import { FocusTracker, Widget } from '@lumino/widgets';
|
|
9
9
|
/**
|
|
10
10
|
* The type for all JupyterFrontEnd application plugins.
|
|
11
11
|
*
|
|
@@ -148,6 +148,19 @@ export declare namespace JupyterFrontEnd {
|
|
|
148
148
|
* or "focused" mean, depending on their user interface characteristics.
|
|
149
149
|
*/
|
|
150
150
|
readonly currentWidget: Widget | null;
|
|
151
|
+
/**
|
|
152
|
+
* A signal emitted when the focused widget in the application shell changes.
|
|
153
|
+
*
|
|
154
|
+
* ### Notes
|
|
155
|
+
* Shells may not always have a {@link currentWidget} or it may not change.
|
|
156
|
+
* Therefore implementing this signal is only expected for shells with the ability
|
|
157
|
+
* to switch between active widgets.
|
|
158
|
+
*
|
|
159
|
+
* Although the signal argument type references a focus tracker, the shell
|
|
160
|
+
* current widget may not be the one focused as its definition is an implementation
|
|
161
|
+
* detail.
|
|
162
|
+
*/
|
|
163
|
+
readonly currentChanged?: ISignal<IShell, FocusTracker.IChangedArgs<Widget>>;
|
|
151
164
|
/**
|
|
152
165
|
* Returns an iterator for the widgets inside the application shell.
|
|
153
166
|
*
|
package/lib/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H,CAAC,EAPS,OAAO,KAAP,OAAO,QAOhB;AAED;;GAEG;AACH,MAAM,KAAW,0BAA0B,CAK1C;AALD,WAAiB,0BAA0B;IACzC;;OAEG;IACU,sCAAW,GAAG,8BAA8B,CAAC;AAC5D,CAAC,EALgB,0BAA0B,KAA1B,0BAA0B,QAK1C"}
|
package/lib/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { CommandRegistry } from '@lumino/commands';
|
|
|
4
4
|
import { JupyterFrontEnd } from './frontend';
|
|
5
5
|
export interface ISemanticCommandDefault {
|
|
6
6
|
/**
|
|
7
|
-
* Default command to execute if no command is enabled
|
|
7
|
+
* Default command id to execute if no command is enabled
|
|
8
8
|
*/
|
|
9
9
|
execute?: string;
|
|
10
10
|
/**
|
|
@@ -28,6 +28,51 @@ export interface ISemanticCommandDefault {
|
|
|
28
28
|
*/
|
|
29
29
|
isVisible?: boolean;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Semantic command(s) options
|
|
33
|
+
*/
|
|
34
|
+
export interface ISemanticCommandOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Semantic command ID
|
|
37
|
+
*/
|
|
38
|
+
id: string;
|
|
39
|
+
/**
|
|
40
|
+
* Application command registry
|
|
41
|
+
*/
|
|
42
|
+
commands: CommandRegistry;
|
|
43
|
+
/**
|
|
44
|
+
* Application shell
|
|
45
|
+
*/
|
|
46
|
+
shell: JupyterFrontEnd.IShell;
|
|
47
|
+
/**
|
|
48
|
+
* Semantic commands
|
|
49
|
+
*/
|
|
50
|
+
semanticCommands: SemanticCommand | SemanticCommand[];
|
|
51
|
+
/**
|
|
52
|
+
* Default commands options
|
|
53
|
+
*
|
|
54
|
+
* It will be used if the enabled command is not defining one
|
|
55
|
+
* or if no command is enabled.
|
|
56
|
+
*/
|
|
57
|
+
default?: ISemanticCommandDefault;
|
|
58
|
+
/**
|
|
59
|
+
* Override commands options
|
|
60
|
+
*
|
|
61
|
+
* It will override the enabled command attribute.
|
|
62
|
+
*/
|
|
63
|
+
overrides?: Omit<CommandRegistry.ICommandOptions, 'execute'>;
|
|
64
|
+
/**
|
|
65
|
+
* Domain specific translation object.
|
|
66
|
+
*/
|
|
67
|
+
trans?: TranslationBundle;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Add a semantic commands to the application and take care
|
|
71
|
+
* of setting up the command changed signal.
|
|
72
|
+
*
|
|
73
|
+
* @param options Semantic command options
|
|
74
|
+
*/
|
|
75
|
+
export declare function addSemanticCommand(options: ISemanticCommandOptions): void;
|
|
31
76
|
/**
|
|
32
77
|
* Create the command options from the given semantic commands list
|
|
33
78
|
* and the given default values.
|
|
@@ -37,5 +82,11 @@ export interface ISemanticCommandDefault {
|
|
|
37
82
|
* @param defaultValues Default values
|
|
38
83
|
* @param trans Translation bundle
|
|
39
84
|
* @returns Command options
|
|
85
|
+
*
|
|
86
|
+
* @deprecated Please use {@link addSemanticCommand}. This function will
|
|
87
|
+
* be removed of the public API in JupyterLab 5.
|
|
40
88
|
*/
|
|
41
|
-
export declare function createSemanticCommand(app: JupyterFrontEnd
|
|
89
|
+
export declare function createSemanticCommand(app: JupyterFrontEnd | {
|
|
90
|
+
commands: CommandRegistry;
|
|
91
|
+
shell: JupyterFrontEnd.IShell;
|
|
92
|
+
}, semanticCommands: SemanticCommand | SemanticCommand[], defaultValues: ISemanticCommandDefault, trans: TranslationBundle): CommandRegistry.ICommandOptions;
|
package/lib/utils.js
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
* Copyright (c) Jupyter Development Team.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
6
|
+
/**
|
|
7
|
+
* Add a semantic commands to the application and take care
|
|
8
|
+
* of setting up the command changed signal.
|
|
9
|
+
*
|
|
10
|
+
* @param options Semantic command options
|
|
11
|
+
*/
|
|
12
|
+
export function addSemanticCommand(options) {
|
|
13
|
+
const { id, commands, shell, semanticCommands, default: defaultValues, overrides, trans } = options;
|
|
14
|
+
commands.addCommand(id, {
|
|
15
|
+
...createSemanticCommand({ commands, shell }, semanticCommands, defaultValues !== null && defaultValues !== void 0 ? defaultValues : {}, trans !== null && trans !== void 0 ? trans : nullTranslator.load('jupyterlab')),
|
|
16
|
+
...overrides
|
|
17
|
+
});
|
|
18
|
+
const commandList = Array.isArray(semanticCommands)
|
|
19
|
+
? semanticCommands
|
|
20
|
+
: [semanticCommands];
|
|
21
|
+
const onCommandChanged = (commands, args) => {
|
|
22
|
+
if (args.id) {
|
|
23
|
+
if (args.id === id && args.type === 'removed') {
|
|
24
|
+
commands.commandChanged.disconnect(onCommandChanged);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const commandIds = commandList.reduce((agg, cmd) => agg.concat(cmd.ids), []);
|
|
28
|
+
if (commandIds.includes(args.id)) {
|
|
29
|
+
switch (args.type) {
|
|
30
|
+
case 'changed':
|
|
31
|
+
case 'many-changed':
|
|
32
|
+
commands.notifyCommandChanged(id);
|
|
33
|
+
break;
|
|
34
|
+
case 'removed':
|
|
35
|
+
for (const cmd of commandList) {
|
|
36
|
+
cmd.remove(args.id);
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
commands.commandChanged.connect(onCommandChanged);
|
|
45
|
+
}
|
|
5
46
|
/**
|
|
6
47
|
* Create the command options from the given semantic commands list
|
|
7
48
|
* and the given default values.
|
|
@@ -11,6 +52,9 @@
|
|
|
11
52
|
* @param defaultValues Default values
|
|
12
53
|
* @param trans Translation bundle
|
|
13
54
|
* @returns Command options
|
|
55
|
+
*
|
|
56
|
+
* @deprecated Please use {@link addSemanticCommand}. This function will
|
|
57
|
+
* be removed of the public API in JupyterLab 5.
|
|
14
58
|
*/
|
|
15
59
|
export function createSemanticCommand(app, semanticCommands, defaultValues, trans) {
|
|
16
60
|
const { commands, shell } = app;
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAqB,MAAM,yBAAyB,CAAC;AAsE5E;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgC;IACjE,MAAM,EACJ,EAAE,EACF,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,OAAO,EAAE,aAAa,EACtB,SAAS,EACT,KAAK,EACN,GAAG,OAAO,CAAC;IACZ,QAAQ,CAAC,UAAU,CAAC,EAAE,EAAE;QACtB,GAAG,qBAAqB,CACtB,EAAE,QAAQ,EAAE,KAAK,EAAE,EACnB,gBAAgB,EAChB,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,EACnB,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAC3C;QACD,GAAG,SAAS;KACb,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACjD,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAEvB,MAAM,gBAAgB,GAAG,CACvB,QAAyB,EACzB,IAAyC,EACzC,EAAE;QACF,IAAI,IAAI,CAAC,EAAE,EAAE;YACX,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;gBAC7C,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;aACtD;iBAAM;gBACL,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CACnC,CAAC,GAAG,EAAE,GAAG,EAAE,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AC,CAAC;gBAClB,OAAO,CAAC,CAAC;oBACP,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClD,MAAM,IAAI,GAAG,KAAK;yBACf,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;yBACpB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;yBAC7B,IAAI,CAAC,IAAI,CAAC,CAAC;oBACd,MAAM,GAAG,GACP,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAClE,OAAO,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;iBACzC;aACF;QACH,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/application",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-beta.1",
|
|
4
4
|
"description": "JupyterLab - Application",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -43,28 +43,28 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@fortawesome/fontawesome-free": "^5.12.0",
|
|
46
|
-
"@jupyterlab/apputils": "^4.3.0-
|
|
47
|
-
"@jupyterlab/coreutils": "^6.2.0-
|
|
48
|
-
"@jupyterlab/docregistry": "^4.2.0-
|
|
49
|
-
"@jupyterlab/rendermime": "^4.2.0-
|
|
50
|
-
"@jupyterlab/rendermime-interfaces": "^3.10.0-
|
|
51
|
-
"@jupyterlab/services": "^7.2.0-
|
|
52
|
-
"@jupyterlab/statedb": "^4.2.0-
|
|
53
|
-
"@jupyterlab/translation": "^4.2.0-
|
|
54
|
-
"@jupyterlab/ui-components": "^4.2.0-
|
|
46
|
+
"@jupyterlab/apputils": "^4.3.0-beta.1",
|
|
47
|
+
"@jupyterlab/coreutils": "^6.2.0-beta.1",
|
|
48
|
+
"@jupyterlab/docregistry": "^4.2.0-beta.1",
|
|
49
|
+
"@jupyterlab/rendermime": "^4.2.0-beta.1",
|
|
50
|
+
"@jupyterlab/rendermime-interfaces": "^3.10.0-beta.1",
|
|
51
|
+
"@jupyterlab/services": "^7.2.0-beta.1",
|
|
52
|
+
"@jupyterlab/statedb": "^4.2.0-beta.1",
|
|
53
|
+
"@jupyterlab/translation": "^4.2.0-beta.1",
|
|
54
|
+
"@jupyterlab/ui-components": "^4.2.0-beta.1",
|
|
55
55
|
"@lumino/algorithm": "^2.0.1",
|
|
56
|
-
"@lumino/application": "^2.3.
|
|
57
|
-
"@lumino/commands": "^2.
|
|
56
|
+
"@lumino/application": "^2.3.1",
|
|
57
|
+
"@lumino/commands": "^2.3.0",
|
|
58
58
|
"@lumino/coreutils": "^2.1.2",
|
|
59
59
|
"@lumino/disposable": "^2.1.2",
|
|
60
60
|
"@lumino/messaging": "^2.0.1",
|
|
61
61
|
"@lumino/polling": "^2.1.2",
|
|
62
62
|
"@lumino/properties": "^2.0.1",
|
|
63
63
|
"@lumino/signaling": "^2.1.2",
|
|
64
|
-
"@lumino/widgets": "^2.3.
|
|
64
|
+
"@lumino/widgets": "^2.3.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@jupyterlab/testing": "^4.2.0-
|
|
67
|
+
"@jupyterlab/testing": "^4.2.0-beta.1",
|
|
68
68
|
"@types/jest": "^29.2.0",
|
|
69
69
|
"jest": "^29.2.0",
|
|
70
70
|
"rimraf": "~5.0.5",
|
package/src/frontend.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { ContextMenuSvg } from '@jupyterlab/ui-components';
|
|
|
8
8
|
import { Application, IPlugin } from '@lumino/application';
|
|
9
9
|
import { Token } from '@lumino/coreutils';
|
|
10
10
|
import { ISignal, Signal } from '@lumino/signaling';
|
|
11
|
-
import { Widget } from '@lumino/widgets';
|
|
11
|
+
import { FocusTracker, Widget } from '@lumino/widgets';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The type for all JupyterFrontEnd application plugins.
|
|
@@ -276,6 +276,23 @@ export namespace JupyterFrontEnd {
|
|
|
276
276
|
*/
|
|
277
277
|
readonly currentWidget: Widget | null;
|
|
278
278
|
|
|
279
|
+
/**
|
|
280
|
+
* A signal emitted when the focused widget in the application shell changes.
|
|
281
|
+
*
|
|
282
|
+
* ### Notes
|
|
283
|
+
* Shells may not always have a {@link currentWidget} or it may not change.
|
|
284
|
+
* Therefore implementing this signal is only expected for shells with the ability
|
|
285
|
+
* to switch between active widgets.
|
|
286
|
+
*
|
|
287
|
+
* Although the signal argument type references a focus tracker, the shell
|
|
288
|
+
* current widget may not be the one focused as its definition is an implementation
|
|
289
|
+
* detail.
|
|
290
|
+
*/
|
|
291
|
+
readonly currentChanged?: ISignal<
|
|
292
|
+
IShell,
|
|
293
|
+
FocusTracker.IChangedArgs<Widget>
|
|
294
|
+
>;
|
|
295
|
+
|
|
279
296
|
/**
|
|
280
297
|
* Returns an iterator for the widgets inside the application shell.
|
|
281
298
|
*
|
package/src/utils.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { SemanticCommand } from '@jupyterlab/apputils';
|
|
7
|
-
import { TranslationBundle } from '@jupyterlab/translation';
|
|
7
|
+
import { nullTranslator, TranslationBundle } from '@jupyterlab/translation';
|
|
8
8
|
import { CommandRegistry } from '@lumino/commands';
|
|
9
9
|
import { JupyterFrontEnd } from './frontend';
|
|
10
10
|
|
|
11
11
|
export interface ISemanticCommandDefault {
|
|
12
12
|
/**
|
|
13
|
-
* Default command to execute if no command is enabled
|
|
13
|
+
* Default command id to execute if no command is enabled
|
|
14
14
|
*/
|
|
15
15
|
execute?: string;
|
|
16
16
|
/**
|
|
@@ -35,6 +35,106 @@ export interface ISemanticCommandDefault {
|
|
|
35
35
|
isVisible?: boolean;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Semantic command(s) options
|
|
40
|
+
*/
|
|
41
|
+
export interface ISemanticCommandOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Semantic command ID
|
|
44
|
+
*/
|
|
45
|
+
id: string;
|
|
46
|
+
/**
|
|
47
|
+
* Application command registry
|
|
48
|
+
*/
|
|
49
|
+
commands: CommandRegistry;
|
|
50
|
+
/**
|
|
51
|
+
* Application shell
|
|
52
|
+
*/
|
|
53
|
+
shell: JupyterFrontEnd.IShell;
|
|
54
|
+
/**
|
|
55
|
+
* Semantic commands
|
|
56
|
+
*/
|
|
57
|
+
semanticCommands: SemanticCommand | SemanticCommand[];
|
|
58
|
+
/**
|
|
59
|
+
* Default commands options
|
|
60
|
+
*
|
|
61
|
+
* It will be used if the enabled command is not defining one
|
|
62
|
+
* or if no command is enabled.
|
|
63
|
+
*/
|
|
64
|
+
default?: ISemanticCommandDefault;
|
|
65
|
+
/**
|
|
66
|
+
* Override commands options
|
|
67
|
+
*
|
|
68
|
+
* It will override the enabled command attribute.
|
|
69
|
+
*/
|
|
70
|
+
overrides?: Omit<CommandRegistry.ICommandOptions, 'execute'>;
|
|
71
|
+
/**
|
|
72
|
+
* Domain specific translation object.
|
|
73
|
+
*/
|
|
74
|
+
trans?: TranslationBundle;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Add a semantic commands to the application and take care
|
|
79
|
+
* of setting up the command changed signal.
|
|
80
|
+
*
|
|
81
|
+
* @param options Semantic command options
|
|
82
|
+
*/
|
|
83
|
+
export function addSemanticCommand(options: ISemanticCommandOptions): void {
|
|
84
|
+
const {
|
|
85
|
+
id,
|
|
86
|
+
commands,
|
|
87
|
+
shell,
|
|
88
|
+
semanticCommands,
|
|
89
|
+
default: defaultValues,
|
|
90
|
+
overrides,
|
|
91
|
+
trans
|
|
92
|
+
} = options;
|
|
93
|
+
commands.addCommand(id, {
|
|
94
|
+
...createSemanticCommand(
|
|
95
|
+
{ commands, shell },
|
|
96
|
+
semanticCommands,
|
|
97
|
+
defaultValues ?? {},
|
|
98
|
+
trans ?? nullTranslator.load('jupyterlab')
|
|
99
|
+
),
|
|
100
|
+
...overrides
|
|
101
|
+
});
|
|
102
|
+
const commandList = Array.isArray(semanticCommands)
|
|
103
|
+
? semanticCommands
|
|
104
|
+
: [semanticCommands];
|
|
105
|
+
|
|
106
|
+
const onCommandChanged = (
|
|
107
|
+
commands: CommandRegistry,
|
|
108
|
+
args: CommandRegistry.ICommandChangedArgs
|
|
109
|
+
) => {
|
|
110
|
+
if (args.id) {
|
|
111
|
+
if (args.id === id && args.type === 'removed') {
|
|
112
|
+
commands.commandChanged.disconnect(onCommandChanged);
|
|
113
|
+
} else {
|
|
114
|
+
const commandIds = commandList.reduce<string[]>(
|
|
115
|
+
(agg, cmd) => agg.concat(cmd.ids),
|
|
116
|
+
[]
|
|
117
|
+
);
|
|
118
|
+
if (commandIds.includes(args.id)) {
|
|
119
|
+
switch (args.type) {
|
|
120
|
+
case 'changed':
|
|
121
|
+
case 'many-changed':
|
|
122
|
+
commands.notifyCommandChanged(id);
|
|
123
|
+
break;
|
|
124
|
+
case 'removed':
|
|
125
|
+
for (const cmd of commandList) {
|
|
126
|
+
cmd.remove(args.id);
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
commands.commandChanged.connect(onCommandChanged);
|
|
136
|
+
}
|
|
137
|
+
|
|
38
138
|
/**
|
|
39
139
|
* Create the command options from the given semantic commands list
|
|
40
140
|
* and the given default values.
|
|
@@ -44,9 +144,14 @@ export interface ISemanticCommandDefault {
|
|
|
44
144
|
* @param defaultValues Default values
|
|
45
145
|
* @param trans Translation bundle
|
|
46
146
|
* @returns Command options
|
|
147
|
+
*
|
|
148
|
+
* @deprecated Please use {@link addSemanticCommand}. This function will
|
|
149
|
+
* be removed of the public API in JupyterLab 5.
|
|
47
150
|
*/
|
|
48
151
|
export function createSemanticCommand(
|
|
49
|
-
app:
|
|
152
|
+
app:
|
|
153
|
+
| JupyterFrontEnd
|
|
154
|
+
| { commands: CommandRegistry; shell: JupyterFrontEnd.IShell },
|
|
50
155
|
semanticCommands: SemanticCommand | SemanticCommand[],
|
|
51
156
|
defaultValues: ISemanticCommandDefault,
|
|
52
157
|
trans: TranslationBundle
|
package/style/sidepanel.css
CHANGED
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
position: relative;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
.jp-SideBar .lm-TabBar-tab:focus-visible {
|
|
56
|
+
outline: 4px solid var(--jp-accept-color-active, var(--jp-brand-color1));
|
|
57
|
+
outline-offset: -1px;
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
.jp-SideBar .lm-TabBar-tab.lm-mod-current::after {
|
|
56
61
|
/* Internal border override pseudo-element */
|
|
57
62
|
position: absolute;
|