@jupyterlab/cell-toolbar-extension 4.0.0-alpha.6 → 4.0.0-alpha.7

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 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
- var _a;
16
- const settings = (_a = (await (settingRegistry === null || settingRegistry === void 0 ? void 0 : settingRegistry.load(`@jupyterlab/cell-toolbar-extension:plugin`)))) !== null && _a !== void 0 ? _a : null;
17
- app.docRegistry.addWidgetExtension('Notebook', new CellBarExtension(app.commands, settings));
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,CA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;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-alpha.6",
3
+ "version": "4.0.0-alpha.7",
4
4
  "description": "Extension for cell toolbar adapted from jlab-enhanced-cell-toolbar",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -39,17 +39,19 @@
39
39
  "watch": "tsc -b --watch"
40
40
  },
41
41
  "dependencies": {
42
- "@jupyterlab/application": "^4.0.0-alpha.6",
43
- "@jupyterlab/cell-toolbar": "^4.0.0-alpha.6",
44
- "@jupyterlab/settingregistry": "^4.0.0-alpha.6"
42
+ "@jupyterlab/application": "^4.0.0-alpha.9",
43
+ "@jupyterlab/apputils": "^4.0.0-alpha.9",
44
+ "@jupyterlab/cell-toolbar": "^4.0.0-alpha.7",
45
+ "@jupyterlab/settingregistry": "^4.0.0-alpha.9",
46
+ "@jupyterlab/translation": "^4.0.0-alpha.9"
45
47
  },
46
48
  "devDependencies": {
47
- "@jupyterlab/testutils": "^4.0.0-alpha.6",
49
+ "@jupyterlab/testutils": "^4.0.0-alpha.9",
48
50
  "@types/jest": "^26.0.10",
49
51
  "jest": "^26.4.2",
50
52
  "rimraf": "~3.0.0",
51
53
  "ts-jest": "^26.3.0",
52
- "typescript": "~4.5.2"
54
+ "typescript": "~4.6.3"
53
55
  },
54
56
  "publishConfig": {
55
57
  "access": "public"
@@ -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
- "leftMenu": {
7
- "title": "List of menu items",
8
- "description": "An item is defined by a 'command' name and an 'icon' name + optionally a 'tooltip' and the 'cellType' on which it applies",
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/menuItem"
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
- "menuItem": {
51
- "type": "object",
43
+ "toolbarItem": {
52
44
  "properties": {
53
- "command": {
54
- "title": "Command ID to be executed",
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 ID",
64
+ "title": "Item icon id",
65
+ "description": "If defined, it will override the command icon",
59
66
  "type": "string"
60
67
  },
61
- "tooltip": {
62
- "title": "Item tooltip",
68
+ "label": {
69
+ "title": "Item label",
70
+ "description": "If defined, it will override the command label",
63
71
  "type": "string"
64
72
  },
65
- "cellType": {
66
- "title": "Cell type on which to display the item",
67
- "description": "Leave empty to define on all cells",
73
+ "type": {
74
+ "title": "Item type",
68
75
  "type": "string",
69
- "enum": ["code", "markdown", "raw"]
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
- "required": ["command", "icon"]
87
+ "type": "object"
74
88
  }
75
89
  }
76
90
  }
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';