@jupyterlab/cell-toolbar-extension 4.0.0-alpha.7 → 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.
Files changed (2) hide show
  1. package/package.json +9 -18
  2. package/src/index.ts +50 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/cell-toolbar-extension",
3
- "version": "4.0.0-alpha.7",
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,33 +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-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"
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"
47
42
  },
48
43
  "devDependencies": {
49
- "@jupyterlab/testutils": "^4.0.0-alpha.9",
50
- "@types/jest": "^26.0.10",
51
- "jest": "^26.4.2",
52
44
  "rimraf": "~3.0.0",
53
- "ts-jest": "^26.3.0",
54
- "typescript": "~4.6.3"
45
+ "typescript": "~5.0.2"
55
46
  },
56
47
  "publishConfig": {
57
48
  "access": "public"
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;