@jupyterlab/cell-toolbar-extension 4.0.0-alpha.6 → 4.0.0-beta.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.
- package/lib/index.js +8 -5
- package/lib/index.js.map +1 -1
- package/package.json +9 -16
- package/schema/plugin.json +62 -48
- package/src/index.ts +50 -0
- package/style/index.css +1 -0
- package/style/index.js +1 -0
package/lib/index.js
CHANGED
|
@@ -8,15 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
10
10
|
import { CellBarExtension } from '@jupyterlab/cell-toolbar';
|
|
11
|
+
import { createToolbarFactory, IToolbarWidgetRegistry } from '@jupyterlab/apputils';
|
|
12
|
+
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
11
13
|
const cellToolbar = {
|
|
12
14
|
id: '@jupyterlab/cell-toolbar-extension:plugin',
|
|
13
15
|
autoStart: true,
|
|
14
|
-
activate: async (app, settingRegistry) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
activate: async (app, settingRegistry, toolbarRegistry, translator) => {
|
|
17
|
+
const toolbarItems = settingRegistry && toolbarRegistry
|
|
18
|
+
? createToolbarFactory(toolbarRegistry, settingRegistry, CellBarExtension.FACTORY_NAME, cellToolbar.id, translator !== null && translator !== void 0 ? translator : nullTranslator)
|
|
19
|
+
: undefined;
|
|
20
|
+
app.docRegistry.addWidgetExtension('Notebook', new CellBarExtension(app.commands, toolbarItems));
|
|
18
21
|
},
|
|
19
|
-
optional: [ISettingRegistry]
|
|
22
|
+
optional: [ISettingRegistry, IToolbarWidgetRegistry, ITranslator]
|
|
20
23
|
};
|
|
21
24
|
export default cellToolbar;
|
|
22
25
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,WAAW,GAAgC;IAC/C,EAAE,EAAE,2CAA2C;IAC/C,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,KAAK,EACb,GAAoB,EACpB,eAAwC,EACxC,eAA8C,EAC9C,UAA8B,EAC9B,EAAE;QACF,MAAM,YAAY,GAChB,eAAe,IAAI,eAAe;YAChC,CAAC,CAAC,oBAAoB,CAClB,eAAe,EACf,eAAe,EACf,gBAAgB,CAAC,YAAY,EAC7B,WAAW,CAAC,EAAE,EACd,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,cAAc,CAC7B;YACH,CAAC,CAAC,SAAS,CAAC;QAEhB,GAAG,CAAC,WAAW,CAAC,kBAAkB,CAChC,UAAU,EACV,IAAI,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CACjD,CAAC;IACJ,CAAC;IACD,QAAQ,EAAE,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,WAAW,CAAC;CAClE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/cell-toolbar-extension",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "Extension for cell toolbar adapted from jlab-enhanced-cell-toolbar",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -25,31 +25,24 @@
|
|
|
25
25
|
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
|
|
26
26
|
"schema/*.json",
|
|
27
27
|
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
|
|
28
|
-
"style/index.js"
|
|
28
|
+
"style/index.js",
|
|
29
|
+
"src/**/*.{ts,tsx}"
|
|
29
30
|
],
|
|
30
31
|
"scripts": {
|
|
31
32
|
"build": "tsc -b",
|
|
32
|
-
"build:all": "npm run build",
|
|
33
|
-
"build:test": "tsc --build tsconfig.test.json",
|
|
34
33
|
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
|
|
35
|
-
"test": "jest",
|
|
36
|
-
"test:cov": "jest --collect-coverage",
|
|
37
|
-
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
38
|
-
"test:debug:watch": "node --inspect-brk node_modules/.bin/jest --runInBand --watch",
|
|
39
34
|
"watch": "tsc -b --watch"
|
|
40
35
|
},
|
|
41
36
|
"dependencies": {
|
|
42
|
-
"@jupyterlab/application": "^4.0.0-
|
|
43
|
-
"@jupyterlab/
|
|
44
|
-
"@jupyterlab/
|
|
37
|
+
"@jupyterlab/application": "^4.0.0-beta.0",
|
|
38
|
+
"@jupyterlab/apputils": "^4.0.0-beta.0",
|
|
39
|
+
"@jupyterlab/cell-toolbar": "^4.0.0-beta.0",
|
|
40
|
+
"@jupyterlab/settingregistry": "^4.0.0-beta.0",
|
|
41
|
+
"@jupyterlab/translation": "^4.0.0-beta.0"
|
|
45
42
|
},
|
|
46
43
|
"devDependencies": {
|
|
47
|
-
"@jupyterlab/testutils": "^4.0.0-alpha.6",
|
|
48
|
-
"@types/jest": "^26.0.10",
|
|
49
|
-
"jest": "^26.4.2",
|
|
50
44
|
"rimraf": "~3.0.0",
|
|
51
|
-
"
|
|
52
|
-
"typescript": "~4.5.2"
|
|
45
|
+
"typescript": "~5.0.2"
|
|
53
46
|
},
|
|
54
47
|
"publishConfig": {
|
|
55
48
|
"access": "public"
|
package/schema/plugin.json
CHANGED
|
@@ -2,75 +2,89 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"title": "Cell Toolbar",
|
|
4
4
|
"description": "Cell Toolbar Settings.",
|
|
5
|
+
"jupyter.lab.toolbars": {
|
|
6
|
+
"Cell": [
|
|
7
|
+
{
|
|
8
|
+
"name": "duplicate-cell",
|
|
9
|
+
"command": "notebook:duplicate-below"
|
|
10
|
+
},
|
|
11
|
+
{ "name": "move-cell-up", "command": "notebook:move-cell-up" },
|
|
12
|
+
{ "name": "move-cell-down", "command": "notebook:move-cell-down" },
|
|
13
|
+
{
|
|
14
|
+
"name": "insert-cell-above",
|
|
15
|
+
"command": "notebook:insert-cell-above"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "insert-cell-below",
|
|
19
|
+
"command": "notebook:insert-cell-below"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"command": "notebook:delete-cell",
|
|
23
|
+
"icon": "ui-components:delete",
|
|
24
|
+
"name": "delete-cell"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"jupyter.lab.transform": true,
|
|
5
29
|
"properties": {
|
|
6
|
-
"
|
|
7
|
-
"title": "List of
|
|
8
|
-
"description": "An item is defined by a 'command' name and an 'icon' name
|
|
30
|
+
"toolbar": {
|
|
31
|
+
"title": "List of toolbar items",
|
|
32
|
+
"description": "An item is defined by a 'name', a 'command' name, and an 'icon' name",
|
|
9
33
|
"type": "array",
|
|
10
34
|
"items": {
|
|
11
|
-
"$ref": "#/definitions/
|
|
35
|
+
"$ref": "#/definitions/toolbarItem"
|
|
12
36
|
},
|
|
13
|
-
"default": [
|
|
14
|
-
{
|
|
15
|
-
"command": "notebook:duplicate-below",
|
|
16
|
-
"icon": "@jupyterlab/cell-toolbar:duplicate",
|
|
17
|
-
"tooltip": "Duplicate Cell"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"command": "notebook:move-cell-up",
|
|
21
|
-
"icon": "@jupyterlab/cell-toolbar:move-up",
|
|
22
|
-
"tooltip": "Move Cell Up"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"command": "notebook:move-cell-down",
|
|
26
|
-
"icon": "@jupyterlab/cell-toolbar:move-down",
|
|
27
|
-
"tooltip": "Move Cell Down"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"command": "notebook:insert-cell-above",
|
|
31
|
-
"icon": "@jupyterlab/cell-toolbar:add-above",
|
|
32
|
-
"tooltip": "Insert Cell Above"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"command": "notebook:insert-cell-below",
|
|
36
|
-
"icon": "@jupyterlab/cell-toolbar:add-below",
|
|
37
|
-
"tooltip": "Insert Cell Below"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"command": "notebook:delete-cell",
|
|
41
|
-
"icon": "@jupyterlab/cell-toolbar:delete",
|
|
42
|
-
"tooltip": "Delete Cell"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
37
|
+
"default": []
|
|
45
38
|
}
|
|
46
39
|
},
|
|
47
40
|
"additionalProperties": false,
|
|
48
41
|
"type": "object",
|
|
49
42
|
"definitions": {
|
|
50
|
-
"
|
|
51
|
-
"type": "object",
|
|
43
|
+
"toolbarItem": {
|
|
52
44
|
"properties": {
|
|
53
|
-
"
|
|
54
|
-
"title": "
|
|
45
|
+
"name": {
|
|
46
|
+
"title": "Unique name",
|
|
55
47
|
"type": "string"
|
|
56
48
|
},
|
|
49
|
+
"args": {
|
|
50
|
+
"title": "Command arguments",
|
|
51
|
+
"type": "object"
|
|
52
|
+
},
|
|
53
|
+
"command": {
|
|
54
|
+
"title": "Command id",
|
|
55
|
+
"type": "string",
|
|
56
|
+
"default": ""
|
|
57
|
+
},
|
|
58
|
+
"disabled": {
|
|
59
|
+
"title": "Whether the item is ignored or not",
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"default": false
|
|
62
|
+
},
|
|
57
63
|
"icon": {
|
|
58
|
-
"title": "Item icon
|
|
64
|
+
"title": "Item icon id",
|
|
65
|
+
"description": "If defined, it will override the command icon",
|
|
59
66
|
"type": "string"
|
|
60
67
|
},
|
|
61
|
-
"
|
|
62
|
-
"title": "Item
|
|
68
|
+
"label": {
|
|
69
|
+
"title": "Item label",
|
|
70
|
+
"description": "If defined, it will override the command label",
|
|
63
71
|
"type": "string"
|
|
64
72
|
},
|
|
65
|
-
"
|
|
66
|
-
"title": "
|
|
67
|
-
"description": "Leave empty to define on all cells",
|
|
73
|
+
"type": {
|
|
74
|
+
"title": "Item type",
|
|
68
75
|
"type": "string",
|
|
69
|
-
"enum": ["
|
|
76
|
+
"enum": ["command", "spacer"]
|
|
77
|
+
},
|
|
78
|
+
"rank": {
|
|
79
|
+
"title": "Item rank",
|
|
80
|
+
"type": "number",
|
|
81
|
+
"minimum": 0,
|
|
82
|
+
"default": 50
|
|
70
83
|
}
|
|
71
84
|
},
|
|
85
|
+
"required": ["name"],
|
|
72
86
|
"additionalProperties": false,
|
|
73
|
-
"
|
|
87
|
+
"type": "object"
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @module cell-toolbar-extension
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
JupyterFrontEnd,
|
|
12
|
+
JupyterFrontEndPlugin
|
|
13
|
+
} from '@jupyterlab/application';
|
|
14
|
+
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
15
|
+
import { CellBarExtension } from '@jupyterlab/cell-toolbar';
|
|
16
|
+
import {
|
|
17
|
+
createToolbarFactory,
|
|
18
|
+
IToolbarWidgetRegistry
|
|
19
|
+
} from '@jupyterlab/apputils';
|
|
20
|
+
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
21
|
+
|
|
22
|
+
const cellToolbar: JupyterFrontEndPlugin<void> = {
|
|
23
|
+
id: '@jupyterlab/cell-toolbar-extension:plugin',
|
|
24
|
+
autoStart: true,
|
|
25
|
+
activate: async (
|
|
26
|
+
app: JupyterFrontEnd,
|
|
27
|
+
settingRegistry: ISettingRegistry | null,
|
|
28
|
+
toolbarRegistry: IToolbarWidgetRegistry | null,
|
|
29
|
+
translator: ITranslator | null
|
|
30
|
+
) => {
|
|
31
|
+
const toolbarItems =
|
|
32
|
+
settingRegistry && toolbarRegistry
|
|
33
|
+
? createToolbarFactory(
|
|
34
|
+
toolbarRegistry,
|
|
35
|
+
settingRegistry,
|
|
36
|
+
CellBarExtension.FACTORY_NAME,
|
|
37
|
+
cellToolbar.id,
|
|
38
|
+
translator ?? nullTranslator
|
|
39
|
+
)
|
|
40
|
+
: undefined;
|
|
41
|
+
|
|
42
|
+
app.docRegistry.addWidgetExtension(
|
|
43
|
+
'Notebook',
|
|
44
|
+
new CellBarExtension(app.commands, toolbarItems)
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
optional: [ISettingRegistry, IToolbarWidgetRegistry, ITranslator]
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default cellToolbar;
|
package/style/index.css
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
|----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
|
|
7
|
+
@import url('~@jupyterlab/apputils/style/index.css');
|
|
7
8
|
@import url('~@jupyterlab/application/style/index.css');
|
|
8
9
|
@import url('~@jupyterlab/cell-toolbar/style/index.css');
|
package/style/index.js
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
|----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
|
|
7
|
+
import '@jupyterlab/apputils/style/index.js';
|
|
7
8
|
import '@jupyterlab/application/style/index.js';
|
|
8
9
|
import '@jupyterlab/cell-toolbar/style/index.js';
|