@jupyterlab/notebook-extension 4.0.0-alpha.20 → 4.0.0-alpha.21

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.
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Copyright (c) Jupyter Development Team.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ import React from 'react';
6
+ import { NotebookTools } from '@jupyterlab/notebook';
7
+ import { ObservableJSON } from '@jupyterlab/observables';
8
+ const CELL_METADATA_EDITOR_CLASS = 'jp-CellMetadataEditor';
9
+ const NOTEBOOK_METADATA_EDITOR_CLASS = 'jp-NotebookMetadataEditor';
10
+ /**
11
+ * The cell metadata field.
12
+ *
13
+ * ## Note
14
+ * This field does not work as other metadata form fields, as it does not use RJSF to update metadata.
15
+ * It extends the MetadataEditorTool which updates itself the metadata.
16
+ * It only renders the node of MetadataEditorTool in a React element instead of displaying a RJSF field.
17
+ */
18
+ export class CellMetadataField extends NotebookTools.MetadataEditorTool {
19
+ constructor(options) {
20
+ super(options);
21
+ this._tracker = options.tracker;
22
+ this.editor.editorHostNode.addEventListener('blur', this.editor, true);
23
+ this.editor.editorHostNode.addEventListener('click', this.editor, true);
24
+ this.editor.headerNode.addEventListener('click', this.editor);
25
+ }
26
+ _onSourceChanged() {
27
+ var _a;
28
+ if (this.editor.source) {
29
+ (_a = this._tracker.activeCell) === null || _a === void 0 ? void 0 : _a.model.sharedModel.setMetadata(this.editor.source.toJSON());
30
+ }
31
+ }
32
+ render(props) {
33
+ var _a;
34
+ const cell = this._tracker.activeCell;
35
+ this.editor.source = cell
36
+ ? new ObservableJSON({ values: cell.model.metadata })
37
+ : null;
38
+ (_a = this.editor.source) === null || _a === void 0 ? void 0 : _a.changed.connect(this._onSourceChanged, this);
39
+ return (React.createElement("div", { className: CELL_METADATA_EDITOR_CLASS },
40
+ React.createElement("div", { ref: ref => ref === null || ref === void 0 ? void 0 : ref.appendChild(this.node) })));
41
+ }
42
+ }
43
+ /**
44
+ * The notebook metadata field.
45
+ *
46
+ * ## Note
47
+ * This field does not work as other metadata form fields, as it does not use RJSF to update metadata.
48
+ * It extends the MetadataEditorTool which updates itself the metadata.
49
+ * It only renders the node of MetadataEditorTool in a React element instead of displaying a RJSF field.
50
+ */
51
+ export class NotebookMetadataField extends NotebookTools.MetadataEditorTool {
52
+ constructor(options) {
53
+ super(options);
54
+ this._tracker = options.tracker;
55
+ this.editor.editorHostNode.addEventListener('blur', this.editor, true);
56
+ this.editor.editorHostNode.addEventListener('click', this.editor, true);
57
+ this.editor.headerNode.addEventListener('click', this.editor);
58
+ }
59
+ _onSourceChanged() {
60
+ var _a, _b;
61
+ if (this.editor.source) {
62
+ (_b = (_a = this._tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.sharedModel.setMetadata(this.editor.source.toJSON());
63
+ }
64
+ }
65
+ render(props) {
66
+ var _a, _b;
67
+ const notebook = this._tracker.currentWidget;
68
+ this.editor.source = notebook
69
+ ? new ObservableJSON({ values: (_a = notebook.model) === null || _a === void 0 ? void 0 : _a.metadata })
70
+ : null;
71
+ (_b = this.editor.source) === null || _b === void 0 ? void 0 : _b.changed.connect(this._onSourceChanged, this);
72
+ return (React.createElement("div", { className: NOTEBOOK_METADATA_EDITOR_CLASS },
73
+ React.createElement("div", { ref: ref => ref === null || ref === void 0 ? void 0 : ref.appendChild(this.node) })));
74
+ }
75
+ }
76
+ //# sourceMappingURL=metadataEditorFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadataEditorFields.js","sourceRoot":"","sources":["../../src/tool-widgets/metadataEditorFields.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;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O,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAEjE,OAAO,CACL,6BAAK,SAAS,EAAE,8BAA8B;YAC5C,6BAAK,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAQ,CAChD,CACP,CAAC;IACJ,CAAC;CAGF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/notebook-extension",
3
- "version": "4.0.0-alpha.20",
3
+ "version": "4.0.0-alpha.21",
4
4
  "description": "JupyterLab - Notebook Extension",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -22,9 +22,9 @@
22
22
  "lib": "lib/"
23
23
  },
24
24
  "files": [
25
- "lib/*.d.ts",
26
- "lib/*.js.map",
27
- "lib/*.js",
25
+ "lib/**/*.d.ts",
26
+ "lib/**/*.js.map",
27
+ "lib/**/*.js",
28
28
  "schema/*.json",
29
29
  "style/*.css",
30
30
  "style/index.js",
@@ -37,45 +37,50 @@
37
37
  "watch": "tsc -b --watch"
38
38
  },
39
39
  "dependencies": {
40
- "@jupyterlab/application": "^4.0.0-alpha.20",
41
- "@jupyterlab/apputils": "^4.0.0-alpha.20",
42
- "@jupyterlab/cells": "^4.0.0-alpha.20",
43
- "@jupyterlab/codeeditor": "^4.0.0-alpha.20",
44
- "@jupyterlab/codemirror": "^4.0.0-alpha.20",
45
- "@jupyterlab/completer": "^4.0.0-alpha.20",
46
- "@jupyterlab/coreutils": "^6.0.0-alpha.20",
47
- "@jupyterlab/docmanager": "^4.0.0-alpha.20",
48
- "@jupyterlab/docmanager-extension": "^4.0.0-alpha.20",
49
- "@jupyterlab/docregistry": "^4.0.0-alpha.20",
50
- "@jupyterlab/documentsearch": "^4.0.0-alpha.20",
51
- "@jupyterlab/filebrowser": "^4.0.0-alpha.20",
52
- "@jupyterlab/launcher": "^4.0.0-alpha.20",
53
- "@jupyterlab/logconsole": "^4.0.0-alpha.20",
54
- "@jupyterlab/lsp": "^4.0.0-alpha.20",
55
- "@jupyterlab/mainmenu": "^4.0.0-alpha.20",
56
- "@jupyterlab/nbformat": "^4.0.0-alpha.20",
57
- "@jupyterlab/notebook": "^4.0.0-alpha.20",
58
- "@jupyterlab/observables": "^5.0.0-alpha.20",
59
- "@jupyterlab/property-inspector": "^4.0.0-alpha.20",
60
- "@jupyterlab/rendermime": "^4.0.0-alpha.20",
61
- "@jupyterlab/services": "^7.0.0-alpha.20",
62
- "@jupyterlab/settingregistry": "^4.0.0-alpha.20",
63
- "@jupyterlab/statedb": "^4.0.0-alpha.20",
64
- "@jupyterlab/statusbar": "^4.0.0-alpha.20",
65
- "@jupyterlab/toc": "^6.0.0-alpha.20",
66
- "@jupyterlab/translation": "^4.0.0-alpha.20",
67
- "@jupyterlab/ui-components": "^4.0.0-alpha.35",
68
- "@lumino/algorithm": "^2.0.0-rc.0",
69
- "@lumino/commands": "^2.0.0-rc.0",
70
- "@lumino/coreutils": "^2.0.0-rc.0",
71
- "@lumino/disposable": "^2.0.0-rc.0",
72
- "@lumino/messaging": "^2.0.0-rc.0",
73
- "@lumino/widgets": "^2.0.0-rc.0"
40
+ "@jupyter/ydoc": "^0.3.4",
41
+ "@jupyterlab/application": "^4.0.0-alpha.21",
42
+ "@jupyterlab/apputils": "^4.0.0-alpha.21",
43
+ "@jupyterlab/cells": "^4.0.0-alpha.21",
44
+ "@jupyterlab/codeeditor": "^4.0.0-alpha.21",
45
+ "@jupyterlab/codemirror": "^4.0.0-alpha.21",
46
+ "@jupyterlab/completer": "^4.0.0-alpha.21",
47
+ "@jupyterlab/coreutils": "^6.0.0-alpha.21",
48
+ "@jupyterlab/docmanager": "^4.0.0-alpha.21",
49
+ "@jupyterlab/docmanager-extension": "^4.0.0-alpha.21",
50
+ "@jupyterlab/docregistry": "^4.0.0-alpha.21",
51
+ "@jupyterlab/documentsearch": "^4.0.0-alpha.21",
52
+ "@jupyterlab/filebrowser": "^4.0.0-alpha.21",
53
+ "@jupyterlab/launcher": "^4.0.0-alpha.21",
54
+ "@jupyterlab/logconsole": "^4.0.0-alpha.21",
55
+ "@jupyterlab/lsp": "^4.0.0-alpha.21",
56
+ "@jupyterlab/mainmenu": "^4.0.0-alpha.21",
57
+ "@jupyterlab/metadataform": "^4.0.0-alpha.21",
58
+ "@jupyterlab/nbformat": "^4.0.0-alpha.21",
59
+ "@jupyterlab/notebook": "^4.0.0-alpha.21",
60
+ "@jupyterlab/observables": "^5.0.0-alpha.21",
61
+ "@jupyterlab/property-inspector": "^4.0.0-alpha.21",
62
+ "@jupyterlab/rendermime": "^4.0.0-alpha.21",
63
+ "@jupyterlab/services": "^7.0.0-alpha.21",
64
+ "@jupyterlab/settingregistry": "^4.0.0-alpha.21",
65
+ "@jupyterlab/statedb": "^4.0.0-alpha.21",
66
+ "@jupyterlab/statusbar": "^4.0.0-alpha.21",
67
+ "@jupyterlab/toc": "^6.0.0-alpha.21",
68
+ "@jupyterlab/translation": "^4.0.0-alpha.21",
69
+ "@jupyterlab/ui-components": "^4.0.0-alpha.36",
70
+ "@lumino/algorithm": "^2.0.0-rc.1",
71
+ "@lumino/commands": "^2.0.0-rc.1",
72
+ "@lumino/coreutils": "^2.0.0-rc.1",
73
+ "@lumino/disposable": "^2.0.0-rc.1",
74
+ "@lumino/messaging": "^2.0.0-rc.1",
75
+ "@lumino/polling": "^2.0.0-rc.1",
76
+ "@lumino/widgets": "^2.0.0-rc.1",
77
+ "@rjsf/utils": "^5.1.0",
78
+ "react": "^18.2.0"
74
79
  },
75
80
  "devDependencies": {
76
81
  "rimraf": "~3.0.0",
77
82
  "typedoc": "~0.23.25",
78
- "typescript": "~5.0.0-beta"
83
+ "typescript": "~5.0.1-rc"
79
84
  },
80
85
  "publishConfig": {
81
86
  "access": "public"
@@ -0,0 +1,143 @@
1
+ {
2
+ "type": "object",
3
+ "title": "Common tools",
4
+ "description": "Setting for the common tools",
5
+ "jupyter.lab.metadataforms": [
6
+ {
7
+ "id": "commonToolsSection",
8
+ "label": "Common Tools",
9
+ "metadataSchema": {
10
+ "type": "object",
11
+ "properties": {
12
+ "_CELL-TOOL": {
13
+ "title": "Cell tool",
14
+ "type": "null"
15
+ },
16
+ "/editable": {
17
+ "title": "Editable",
18
+ "type": "boolean",
19
+ "default": true,
20
+ "oneOf": [
21
+ {
22
+ "const": true,
23
+ "title": "Editable"
24
+ },
25
+ {
26
+ "const": false,
27
+ "title": "Read-Only"
28
+ }
29
+ ]
30
+ },
31
+ "/slideshow/slide_type": {
32
+ "title": "Slide Type",
33
+ "type": "string",
34
+ "default": "",
35
+ "oneOf": [
36
+ {
37
+ "const": "",
38
+ "title": "-"
39
+ },
40
+ {
41
+ "const": "slide",
42
+ "title": "Slide"
43
+ },
44
+ {
45
+ "const": "subslide",
46
+ "title": "Sub-Slide"
47
+ },
48
+ {
49
+ "const": "fragment",
50
+ "title": "Fragment"
51
+ },
52
+ {
53
+ "const": "skip",
54
+ "title": "Skip"
55
+ },
56
+ {
57
+ "const": "notes",
58
+ "title": "Notes"
59
+ }
60
+ ]
61
+ },
62
+ "/raw_mimetype": {
63
+ "title": "Raw NBConvert Format",
64
+ "type": "string",
65
+ "default": "",
66
+ "oneOf": [
67
+ {
68
+ "const": "",
69
+ "title": "-"
70
+ },
71
+ {
72
+ "const": "pdf",
73
+ "title": "PDF"
74
+ },
75
+ {
76
+ "const": "slides",
77
+ "title": "Slides"
78
+ },
79
+ {
80
+ "const": "script",
81
+ "title": "Script"
82
+ },
83
+ {
84
+ "const": "notebook",
85
+ "title": "Notebook"
86
+ },
87
+ {
88
+ "const": "custom",
89
+ "title": "Custom"
90
+ }
91
+ ]
92
+ },
93
+ "/toc/base_numbering": {
94
+ "title": "Table of content - Base number",
95
+ "type": "integer"
96
+ }
97
+ }
98
+ },
99
+ "uiSchema": {
100
+ "/editable": {
101
+ "ui:widget": "select"
102
+ }
103
+ },
104
+ "metadataOptions": {
105
+ "_CELL-TOOL": {
106
+ "customRenderer": "notebook-extension:active-cell-tool.renderer"
107
+ },
108
+ "/raw_mimetype": {
109
+ "cellTypes": ["raw"]
110
+ },
111
+ "/toc/base_numbering": {
112
+ "metadataLevel": "notebook"
113
+ }
114
+ }
115
+ },
116
+ {
117
+ "id": "advancedToolsSection",
118
+ "label": "Advanced Tools",
119
+ "metadataSchema": {
120
+ "type": "object",
121
+ "properties": {
122
+ "_CELL-METADATA": {
123
+ "title": "Cell metadata",
124
+ "type": "null"
125
+ },
126
+ "_NOTEBOOK-METADATA": {
127
+ "title": "Notebook metadata",
128
+ "type": "null"
129
+ }
130
+ }
131
+ },
132
+ "metadataOptions": {
133
+ "_CELL-METADATA": {
134
+ "customRenderer": "notebook-extension:metadata-editor.cell-metadata"
135
+ },
136
+ "_NOTEBOOK-METADATA": {
137
+ "customRenderer": "notebook-extension:metadata-editor.notebook-metadata"
138
+ }
139
+ }
140
+ }
141
+ ],
142
+ "additionalProperties": false
143
+ }
@@ -746,9 +746,9 @@
746
746
  "showProgress": true
747
747
  }
748
748
  },
749
- "experimentalDisableDocumentWideUndoRedo": {
750
- "title": "Experimental settings to enable the undo/redo on the notebook document level.",
751
- "description": "Disable the undo/redo on the notebook document level, so actions independent cells can have their own history. The undo/redo never applies on the outputs, in other words, outputs don't have history. A moved cell completely looses history capability for now.",
749
+ "documentWideUndoRedo": {
750
+ "title": "Enable undo/redo actions at the notebook document level.",
751
+ "description": "Enables the undo/redo actions at the notebook document level; aka undoing within a cell may undo the latest notebook change that happen in another cell. This is deprecated and will be removed in 5.0.0.",
752
752
  "type": "boolean",
753
753
  "default": false
754
754
  },