@theia/notebook 1.53.0-next.5 → 1.53.0-next.55
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/README.md +30 -30
- package/lib/browser/contributions/notebook-actions-contribution.d.ts +1 -0
- package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -1
- package/lib/browser/contributions/notebook-actions-contribution.js +31 -5
- package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -1
- package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +2 -0
- package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -1
- package/lib/browser/contributions/notebook-cell-actions-contribution.js +41 -7
- package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -1
- package/lib/browser/contributions/notebook-status-bar-contribution.d.ts +14 -0
- package/lib/browser/contributions/notebook-status-bar-contribution.d.ts.map +1 -0
- package/lib/browser/contributions/notebook-status-bar-contribution.js +75 -0
- package/lib/browser/contributions/notebook-status-bar-contribution.js.map +1 -0
- package/lib/browser/notebook-editor-widget.d.ts.map +1 -1
- package/lib/browser/notebook-editor-widget.js +3 -5
- package/lib/browser/notebook-editor-widget.js.map +1 -1
- package/lib/browser/notebook-frontend-module.d.ts.map +1 -1
- package/lib/browser/notebook-frontend-module.js +3 -0
- package/lib/browser/notebook-frontend-module.js.map +1 -1
- package/lib/browser/notebook-open-handler.d.ts +3 -2
- package/lib/browser/notebook-open-handler.d.ts.map +1 -1
- package/lib/browser/notebook-open-handler.js +12 -5
- package/lib/browser/notebook-open-handler.js.map +1 -1
- package/lib/browser/view/notebook-cell-editor.d.ts +1 -0
- package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -1
- package/lib/browser/view/notebook-cell-editor.js +30 -16
- package/lib/browser/view/notebook-cell-editor.js.map +1 -1
- package/lib/browser/view/notebook-cell-list-view.d.ts +6 -4
- package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -1
- package/lib/browser/view/notebook-cell-list-view.js +20 -13
- package/lib/browser/view/notebook-cell-list-view.js.map +1 -1
- package/lib/browser/view-model/notebook-cell-model.d.ts +3 -0
- package/lib/browser/view-model/notebook-cell-model.d.ts.map +1 -1
- package/lib/browser/view-model/notebook-cell-model.js +5 -0
- package/lib/browser/view-model/notebook-cell-model.js.map +1 -1
- package/package.json +8 -8
- package/src/browser/contributions/cell-operations.ts +44 -44
- package/src/browser/contributions/notebook-actions-contribution.ts +379 -350
- package/src/browser/contributions/notebook-cell-actions-contribution.ts +525 -487
- package/src/browser/contributions/notebook-color-contribution.ts +268 -268
- package/src/browser/contributions/notebook-context-keys.ts +113 -113
- package/src/browser/contributions/notebook-label-provider-contribution.ts +85 -85
- package/src/browser/contributions/notebook-outline-contribution.ts +114 -114
- package/src/browser/contributions/notebook-output-action-contribution.ts +82 -82
- package/src/browser/contributions/notebook-preferences.ts +92 -92
- package/src/browser/contributions/notebook-status-bar-contribution.ts +77 -0
- package/src/browser/contributions/notebook-undo-redo-handler.ts +41 -41
- package/src/browser/index.ts +27 -27
- package/src/browser/notebook-cell-resource-resolver.ts +130 -130
- package/src/browser/notebook-editor-widget-factory.ts +82 -82
- package/src/browser/notebook-editor-widget.tsx +330 -331
- package/src/browser/notebook-frontend-module.ts +119 -115
- package/src/browser/notebook-open-handler.ts +120 -114
- package/src/browser/notebook-output-utils.ts +119 -119
- package/src/browser/notebook-renderer-registry.ts +85 -85
- package/src/browser/notebook-type-registry.ts +54 -54
- package/src/browser/notebook-types.ts +186 -186
- package/src/browser/renderers/cell-output-webview.ts +33 -33
- package/src/browser/service/notebook-clipboard-service.ts +43 -43
- package/src/browser/service/notebook-context-manager.ts +162 -162
- package/src/browser/service/notebook-editor-widget-service.ts +101 -101
- package/src/browser/service/notebook-execution-service.ts +139 -139
- package/src/browser/service/notebook-execution-state-service.ts +311 -311
- package/src/browser/service/notebook-kernel-history-service.ts +124 -124
- package/src/browser/service/notebook-kernel-quick-pick-service.ts +479 -479
- package/src/browser/service/notebook-kernel-service.ts +357 -357
- package/src/browser/service/notebook-model-resolver-service.ts +160 -160
- package/src/browser/service/notebook-monaco-text-model-service.ts +48 -48
- package/src/browser/service/notebook-options.ts +155 -155
- package/src/browser/service/notebook-renderer-messaging-service.ts +121 -121
- package/src/browser/service/notebook-service.ts +215 -215
- package/src/browser/style/index.css +483 -471
- package/src/browser/view/notebook-cell-editor.tsx +263 -247
- package/src/browser/view/notebook-cell-list-view.tsx +279 -262
- package/src/browser/view/notebook-cell-toolbar-factory.tsx +102 -102
- package/src/browser/view/notebook-cell-toolbar.tsx +74 -74
- package/src/browser/view/notebook-code-cell-view.tsx +350 -350
- package/src/browser/view/notebook-find-widget.tsx +335 -335
- package/src/browser/view/notebook-main-toolbar.tsx +235 -235
- package/src/browser/view/notebook-markdown-cell-view.tsx +208 -208
- package/src/browser/view/notebook-viewport-service.ts +61 -61
- package/src/browser/view-model/notebook-cell-model.ts +473 -466
- package/src/browser/view-model/notebook-cell-output-model.ts +100 -100
- package/src/browser/view-model/notebook-model.ts +550 -550
- package/src/common/index.ts +18 -18
- package/src/common/notebook-common.ts +337 -337
- package/src/common/notebook-protocol.ts +35 -35
- package/src/common/notebook-range.ts +30 -30
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { Disposable, Emitter } from '@theia/core';
|
|
18
|
-
import { CellOutput, CellOutputItem, isTextStreamMime } from '../../common';
|
|
19
|
-
import { compressOutputItemStreams } from '../notebook-output-utils';
|
|
20
|
-
|
|
21
|
-
export class NotebookCellOutputModel implements Disposable {
|
|
22
|
-
|
|
23
|
-
private didChangeDataEmitter = new Emitter<void>();
|
|
24
|
-
readonly onDidChangeData = this.didChangeDataEmitter.event;
|
|
25
|
-
|
|
26
|
-
private requestOutputPresentationChangeEmitter = new Emitter<void>();
|
|
27
|
-
readonly onRequestOutputPresentationChange = this.requestOutputPresentationChangeEmitter.event;
|
|
28
|
-
|
|
29
|
-
get outputId(): string {
|
|
30
|
-
return this.rawOutput.outputId;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get outputs(): CellOutputItem[] {
|
|
34
|
-
return this.rawOutput.outputs || [];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get metadata(): Record<string, unknown> | undefined {
|
|
38
|
-
return this.rawOutput.metadata;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
constructor(protected rawOutput: CellOutput) { }
|
|
42
|
-
|
|
43
|
-
replaceData(rawData: CellOutput): void {
|
|
44
|
-
this.rawOutput = rawData;
|
|
45
|
-
this.optimizeOutputItems();
|
|
46
|
-
this.didChangeDataEmitter.fire();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
appendData(items: CellOutputItem[]): void {
|
|
50
|
-
this.rawOutput.outputs.push(...items);
|
|
51
|
-
this.optimizeOutputItems();
|
|
52
|
-
this.didChangeDataEmitter.fire();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
dispose(): void {
|
|
56
|
-
this.didChangeDataEmitter.dispose();
|
|
57
|
-
this.requestOutputPresentationChangeEmitter.dispose();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
requestOutputPresentationUpdate(): void {
|
|
61
|
-
this.requestOutputPresentationChangeEmitter.fire();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
getData(): CellOutput {
|
|
65
|
-
return {
|
|
66
|
-
outputs: this.outputs,
|
|
67
|
-
metadata: this.metadata,
|
|
68
|
-
outputId: this.outputId
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private optimizeOutputItems(): void {
|
|
73
|
-
if (this.outputs.length > 1 && this.outputs.every(item => isTextStreamMime(item.mime))) {
|
|
74
|
-
// Look for the mimes in the items, and keep track of their order.
|
|
75
|
-
// Merge the streams into one output item, per mime type.
|
|
76
|
-
const mimeOutputs = new Map<string, Uint8Array[]>();
|
|
77
|
-
const mimeTypes: string[] = [];
|
|
78
|
-
this.outputs.forEach(item => {
|
|
79
|
-
let items: Uint8Array[];
|
|
80
|
-
if (mimeOutputs.has(item.mime)) {
|
|
81
|
-
items = mimeOutputs.get(item.mime)!;
|
|
82
|
-
} else {
|
|
83
|
-
items = [];
|
|
84
|
-
mimeOutputs.set(item.mime, items);
|
|
85
|
-
mimeTypes.push(item.mime);
|
|
86
|
-
}
|
|
87
|
-
items.push(item.data.buffer);
|
|
88
|
-
});
|
|
89
|
-
this.outputs.length = 0;
|
|
90
|
-
mimeTypes.forEach(mime => {
|
|
91
|
-
const compressionResult = compressOutputItemStreams(mimeOutputs.get(mime)!);
|
|
92
|
-
this.outputs.push({
|
|
93
|
-
mime,
|
|
94
|
-
data: compressionResult.data
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { Disposable, Emitter } from '@theia/core';
|
|
18
|
+
import { CellOutput, CellOutputItem, isTextStreamMime } from '../../common';
|
|
19
|
+
import { compressOutputItemStreams } from '../notebook-output-utils';
|
|
20
|
+
|
|
21
|
+
export class NotebookCellOutputModel implements Disposable {
|
|
22
|
+
|
|
23
|
+
private didChangeDataEmitter = new Emitter<void>();
|
|
24
|
+
readonly onDidChangeData = this.didChangeDataEmitter.event;
|
|
25
|
+
|
|
26
|
+
private requestOutputPresentationChangeEmitter = new Emitter<void>();
|
|
27
|
+
readonly onRequestOutputPresentationChange = this.requestOutputPresentationChangeEmitter.event;
|
|
28
|
+
|
|
29
|
+
get outputId(): string {
|
|
30
|
+
return this.rawOutput.outputId;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get outputs(): CellOutputItem[] {
|
|
34
|
+
return this.rawOutput.outputs || [];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get metadata(): Record<string, unknown> | undefined {
|
|
38
|
+
return this.rawOutput.metadata;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
constructor(protected rawOutput: CellOutput) { }
|
|
42
|
+
|
|
43
|
+
replaceData(rawData: CellOutput): void {
|
|
44
|
+
this.rawOutput = rawData;
|
|
45
|
+
this.optimizeOutputItems();
|
|
46
|
+
this.didChangeDataEmitter.fire();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
appendData(items: CellOutputItem[]): void {
|
|
50
|
+
this.rawOutput.outputs.push(...items);
|
|
51
|
+
this.optimizeOutputItems();
|
|
52
|
+
this.didChangeDataEmitter.fire();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
dispose(): void {
|
|
56
|
+
this.didChangeDataEmitter.dispose();
|
|
57
|
+
this.requestOutputPresentationChangeEmitter.dispose();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
requestOutputPresentationUpdate(): void {
|
|
61
|
+
this.requestOutputPresentationChangeEmitter.fire();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getData(): CellOutput {
|
|
65
|
+
return {
|
|
66
|
+
outputs: this.outputs,
|
|
67
|
+
metadata: this.metadata,
|
|
68
|
+
outputId: this.outputId
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private optimizeOutputItems(): void {
|
|
73
|
+
if (this.outputs.length > 1 && this.outputs.every(item => isTextStreamMime(item.mime))) {
|
|
74
|
+
// Look for the mimes in the items, and keep track of their order.
|
|
75
|
+
// Merge the streams into one output item, per mime type.
|
|
76
|
+
const mimeOutputs = new Map<string, Uint8Array[]>();
|
|
77
|
+
const mimeTypes: string[] = [];
|
|
78
|
+
this.outputs.forEach(item => {
|
|
79
|
+
let items: Uint8Array[];
|
|
80
|
+
if (mimeOutputs.has(item.mime)) {
|
|
81
|
+
items = mimeOutputs.get(item.mime)!;
|
|
82
|
+
} else {
|
|
83
|
+
items = [];
|
|
84
|
+
mimeOutputs.set(item.mime, items);
|
|
85
|
+
mimeTypes.push(item.mime);
|
|
86
|
+
}
|
|
87
|
+
items.push(item.data.buffer);
|
|
88
|
+
});
|
|
89
|
+
this.outputs.length = 0;
|
|
90
|
+
mimeTypes.forEach(mime => {
|
|
91
|
+
const compressionResult = compressOutputItemStreams(mimeOutputs.get(mime)!);
|
|
92
|
+
this.outputs.push({
|
|
93
|
+
mime,
|
|
94
|
+
data: compressionResult.data
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|