@theia/notebook 1.41.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 (188) hide show
  1. package/README.md +30 -0
  2. package/lib/browser/contributions/notebook-actions-contribution.d.ts +27 -0
  3. package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -0
  4. package/lib/browser/contributions/notebook-actions-contribution.js +172 -0
  5. package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -0
  6. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +30 -0
  7. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -0
  8. package/lib/browser/contributions/notebook-cell-actions-contribution.js +200 -0
  9. package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -0
  10. package/lib/browser/contributions/notebook-color-contribution.d.ts +6 -0
  11. package/lib/browser/contributions/notebook-color-contribution.d.ts.map +1 -0
  12. package/lib/browser/contributions/notebook-color-contribution.js +252 -0
  13. package/lib/browser/contributions/notebook-color-contribution.js.map +1 -0
  14. package/lib/browser/contributions/notebook-context-keys.d.ts +38 -0
  15. package/lib/browser/contributions/notebook-context-keys.d.ts.map +1 -0
  16. package/lib/browser/contributions/notebook-context-keys.js +95 -0
  17. package/lib/browser/contributions/notebook-context-keys.js.map +1 -0
  18. package/lib/browser/index.d.ts +11 -0
  19. package/lib/browser/index.d.ts.map +1 -0
  20. package/lib/browser/index.js +38 -0
  21. package/lib/browser/index.js.map +1 -0
  22. package/lib/browser/notebook-cell-resource-resolver.d.ts +20 -0
  23. package/lib/browser/notebook-cell-resource-resolver.d.ts.map +1 -0
  24. package/lib/browser/notebook-cell-resource-resolver.js +75 -0
  25. package/lib/browser/notebook-cell-resource-resolver.js.map +1 -0
  26. package/lib/browser/notebook-editor-widget-factory.d.ts +17 -0
  27. package/lib/browser/notebook-editor-widget-factory.d.ts.map +1 -0
  28. package/lib/browser/notebook-editor-widget-factory.js +78 -0
  29. package/lib/browser/notebook-editor-widget-factory.js.map +1 -0
  30. package/lib/browser/notebook-editor-widget.d.ts +49 -0
  31. package/lib/browser/notebook-editor-widget.d.ts.map +1 -0
  32. package/lib/browser/notebook-editor-widget.js +150 -0
  33. package/lib/browser/notebook-editor-widget.js.map +1 -0
  34. package/lib/browser/notebook-frontend-module.d.ts +5 -0
  35. package/lib/browser/notebook-frontend-module.d.ts.map +1 -0
  36. package/lib/browser/notebook-frontend-module.js +81 -0
  37. package/lib/browser/notebook-frontend-module.js.map +1 -0
  38. package/lib/browser/notebook-open-handler.d.ts +18 -0
  39. package/lib/browser/notebook-open-handler.d.ts.map +1 -0
  40. package/lib/browser/notebook-open-handler.js +94 -0
  41. package/lib/browser/notebook-open-handler.js.map +1 -0
  42. package/lib/browser/notebook-renderer-registry.d.ts +17 -0
  43. package/lib/browser/notebook-renderer-registry.d.ts.map +1 -0
  44. package/lib/browser/notebook-renderer-registry.js +63 -0
  45. package/lib/browser/notebook-renderer-registry.js.map +1 -0
  46. package/lib/browser/notebook-type-registry.d.ts +7 -0
  47. package/lib/browser/notebook-type-registry.d.ts.map +1 -0
  48. package/lib/browser/notebook-type-registry.js +42 -0
  49. package/lib/browser/notebook-type-registry.js.map +1 -0
  50. package/lib/browser/renderers/cell-output-webview.d.ts +12 -0
  51. package/lib/browser/renderers/cell-output-webview.d.ts.map +1 -0
  52. package/lib/browser/renderers/cell-output-webview.js +20 -0
  53. package/lib/browser/renderers/cell-output-webview.js.map +1 -0
  54. package/lib/browser/service/notebook-cell-context-manager.d.ts +16 -0
  55. package/lib/browser/service/notebook-cell-context-manager.d.ts.map +1 -0
  56. package/lib/browser/service/notebook-cell-context-manager.js +83 -0
  57. package/lib/browser/service/notebook-cell-context-manager.js.map +1 -0
  58. package/lib/browser/service/notebook-editor-service.d.ts +22 -0
  59. package/lib/browser/service/notebook-editor-service.d.ts.map +1 -0
  60. package/lib/browser/service/notebook-editor-service.js +95 -0
  61. package/lib/browser/service/notebook-editor-service.js.map +1 -0
  62. package/lib/browser/service/notebook-execution-service.d.ts +25 -0
  63. package/lib/browser/service/notebook-execution-service.d.ts.map +1 -0
  64. package/lib/browser/service/notebook-execution-service.js +140 -0
  65. package/lib/browser/service/notebook-execution-service.js.map +1 -0
  66. package/lib/browser/service/notebook-execution-state-service.d.ts +94 -0
  67. package/lib/browser/service/notebook-execution-state-service.d.ts.map +1 -0
  68. package/lib/browser/service/notebook-execution-state-service.js +250 -0
  69. package/lib/browser/service/notebook-execution-state-service.js.map +1 -0
  70. package/lib/browser/service/notebook-kernel-history-service.d.ts +23 -0
  71. package/lib/browser/service/notebook-kernel-history-service.d.ts.map +1 -0
  72. package/lib/browser/service/notebook-kernel-history-service.js +109 -0
  73. package/lib/browser/service/notebook-kernel-history-service.js.map +1 -0
  74. package/lib/browser/service/notebook-kernel-quick-pick-service.d.ts +65 -0
  75. package/lib/browser/service/notebook-kernel-quick-pick-service.d.ts.map +1 -0
  76. package/lib/browser/service/notebook-kernel-quick-pick-service.js +430 -0
  77. package/lib/browser/service/notebook-kernel-quick-pick-service.js.map +1 -0
  78. package/lib/browser/service/notebook-kernel-service.d.ts +112 -0
  79. package/lib/browser/service/notebook-kernel-service.d.ts.map +1 -0
  80. package/lib/browser/service/notebook-kernel-service.js +274 -0
  81. package/lib/browser/service/notebook-kernel-service.js.map +1 -0
  82. package/lib/browser/service/notebook-model-resolver-service.d.ts +26 -0
  83. package/lib/browser/service/notebook-model-resolver-service.d.ts.map +1 -0
  84. package/lib/browser/service/notebook-model-resolver-service.js +139 -0
  85. package/lib/browser/service/notebook-model-resolver-service.js.map +1 -0
  86. package/lib/browser/service/notebook-renderer-messaging-service.d.ts +30 -0
  87. package/lib/browser/service/notebook-renderer-messaging-service.d.ts.map +1 -0
  88. package/lib/browser/service/notebook-renderer-messaging-service.js +94 -0
  89. package/lib/browser/service/notebook-renderer-messaging-service.js.map +1 -0
  90. package/lib/browser/service/notebook-service.d.ts +64 -0
  91. package/lib/browser/service/notebook-service.d.ts.map +1 -0
  92. package/lib/browser/service/notebook-service.js +162 -0
  93. package/lib/browser/service/notebook-service.js.map +1 -0
  94. package/lib/browser/view/notebook-cell-editor.d.ts +26 -0
  95. package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -0
  96. package/lib/browser/view/notebook-cell-editor.js +79 -0
  97. package/lib/browser/view/notebook-cell-editor.js.map +1 -0
  98. package/lib/browser/view/notebook-cell-list-view.d.ts +43 -0
  99. package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -0
  100. package/lib/browser/view/notebook-cell-list-view.js +111 -0
  101. package/lib/browser/view/notebook-cell-list-view.js.map +1 -0
  102. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts +25 -0
  103. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts.map +1 -0
  104. package/lib/browser/view/notebook-cell-toolbar-factory.js +93 -0
  105. package/lib/browser/view/notebook-cell-toolbar-factory.js.map +1 -0
  106. package/lib/browser/view/notebook-cell-toolbar.d.ts +25 -0
  107. package/lib/browser/view/notebook-cell-toolbar.d.ts.map +1 -0
  108. package/lib/browser/view/notebook-cell-toolbar.js +50 -0
  109. package/lib/browser/view/notebook-cell-toolbar.js.map +1 -0
  110. package/lib/browser/view/notebook-code-cell-view.d.ts +47 -0
  111. package/lib/browser/view/notebook-code-cell-view.d.ts.map +1 -0
  112. package/lib/browser/view/notebook-code-cell-view.js +166 -0
  113. package/lib/browser/view/notebook-code-cell-view.js.map +1 -0
  114. package/lib/browser/view/notebook-main-toolbar.d.ts +31 -0
  115. package/lib/browser/view/notebook-main-toolbar.d.ts.map +1 -0
  116. package/lib/browser/view/notebook-main-toolbar.js +118 -0
  117. package/lib/browser/view/notebook-main-toolbar.js.map +1 -0
  118. package/lib/browser/view/notebook-markdown-cell-view.d.ts +12 -0
  119. package/lib/browser/view/notebook-markdown-cell-view.d.ts.map +1 -0
  120. package/lib/browser/view/notebook-markdown-cell-view.js +70 -0
  121. package/lib/browser/view/notebook-markdown-cell-view.js.map +1 -0
  122. package/lib/browser/view-model/notebook-cell-model.d.ts +74 -0
  123. package/lib/browser/view-model/notebook-cell-model.d.ts.map +1 -0
  124. package/lib/browser/view-model/notebook-cell-model.js +226 -0
  125. package/lib/browser/view-model/notebook-cell-model.js.map +1 -0
  126. package/lib/browser/view-model/notebook-cell-output-model.d.ts +19 -0
  127. package/lib/browser/view-model/notebook-cell-output-model.d.ts.map +1 -0
  128. package/lib/browser/view-model/notebook-cell-output-model.js +61 -0
  129. package/lib/browser/view-model/notebook-cell-output-model.js.map +1 -0
  130. package/lib/browser/view-model/notebook-model.d.ts +59 -0
  131. package/lib/browser/view-model/notebook-model.d.ts.map +1 -0
  132. package/lib/browser/view-model/notebook-model.js +315 -0
  133. package/lib/browser/view-model/notebook-model.js.map +1 -0
  134. package/lib/common/index.d.ts +3 -0
  135. package/lib/common/index.d.ts.map +1 -0
  136. package/lib/common/index.js +30 -0
  137. package/lib/common/index.js.map +1 -0
  138. package/lib/common/notebook-common.d.ts +344 -0
  139. package/lib/common/notebook-common.d.ts.map +1 -0
  140. package/lib/common/notebook-common.js +112 -0
  141. package/lib/common/notebook-common.js.map +1 -0
  142. package/lib/common/notebook-protocol.d.ts +21 -0
  143. package/lib/common/notebook-protocol.d.ts.map +1 -0
  144. package/lib/common/notebook-protocol.js +18 -0
  145. package/lib/common/notebook-protocol.js.map +1 -0
  146. package/lib/common/notebook-range.d.ts +14 -0
  147. package/lib/common/notebook-range.d.ts.map +1 -0
  148. package/lib/common/notebook-range.js +18 -0
  149. package/lib/common/notebook-range.js.map +1 -0
  150. package/package.json +52 -0
  151. package/src/browser/contributions/notebook-actions-contribution.ts +171 -0
  152. package/src/browser/contributions/notebook-cell-actions-contribution.ts +204 -0
  153. package/src/browser/contributions/notebook-color-contribution.ts +268 -0
  154. package/src/browser/contributions/notebook-context-keys.ts +99 -0
  155. package/src/browser/index.ts +26 -0
  156. package/src/browser/notebook-cell-resource-resolver.ts +79 -0
  157. package/src/browser/notebook-editor-widget-factory.ts +70 -0
  158. package/src/browser/notebook-editor-widget.tsx +157 -0
  159. package/src/browser/notebook-frontend-module.ts +95 -0
  160. package/src/browser/notebook-open-handler.ts +87 -0
  161. package/src/browser/notebook-renderer-registry.ts +62 -0
  162. package/src/browser/notebook-type-registry.ts +30 -0
  163. package/src/browser/renderers/cell-output-webview.ts +32 -0
  164. package/src/browser/service/notebook-cell-context-manager.ts +70 -0
  165. package/src/browser/service/notebook-editor-service.ts +86 -0
  166. package/src/browser/service/notebook-execution-service.ts +139 -0
  167. package/src/browser/service/notebook-execution-state-service.ts +322 -0
  168. package/src/browser/service/notebook-kernel-history-service.ts +109 -0
  169. package/src/browser/service/notebook-kernel-quick-pick-service.ts +494 -0
  170. package/src/browser/service/notebook-kernel-service.ts +357 -0
  171. package/src/browser/service/notebook-model-resolver-service.ts +141 -0
  172. package/src/browser/service/notebook-renderer-messaging-service.ts +111 -0
  173. package/src/browser/service/notebook-service.ts +178 -0
  174. package/src/browser/style/index.css +236 -0
  175. package/src/browser/view/notebook-cell-editor.tsx +97 -0
  176. package/src/browser/view/notebook-cell-list-view.tsx +171 -0
  177. package/src/browser/view/notebook-cell-toolbar-factory.tsx +91 -0
  178. package/src/browser/view/notebook-cell-toolbar.tsx +70 -0
  179. package/src/browser/view/notebook-code-cell-view.tsx +190 -0
  180. package/src/browser/view/notebook-main-toolbar.tsx +115 -0
  181. package/src/browser/view/notebook-markdown-cell-view.tsx +73 -0
  182. package/src/browser/view-model/notebook-cell-model.ts +271 -0
  183. package/src/browser/view-model/notebook-cell-output-model.ts +69 -0
  184. package/src/browser/view-model/notebook-model.ts +372 -0
  185. package/src/common/index.ts +18 -0
  186. package/src/common/notebook-common.ts +462 -0
  187. package/src/common/notebook-protocol.ts +35 -0
  188. package/src/common/notebook-range.ts +30 -0
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2023 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.NotebookCellToolbarFactory = void 0;
28
+ const React = require("@theia/core/shared/react");
29
+ const core_1 = require("@theia/core");
30
+ const inversify_1 = require("@theia/core/shared/inversify");
31
+ const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
32
+ const notebook_cell_toolbar_1 = require("./notebook-cell-toolbar");
33
+ const browser_1 = require("@theia/core/lib/browser");
34
+ let NotebookCellToolbarFactory = class NotebookCellToolbarFactory {
35
+ renderCellToolbar(menuPath, notebookModel, cell) {
36
+ return React.createElement(notebook_cell_toolbar_1.NotebookCellToolbar, { getMenuItems: () => this.getMenuItems(menuPath, notebookModel, cell), onContextKeysChanged: cell.notebookCellContextManager.onDidChangeContext });
37
+ }
38
+ renderSidebar(menuPath, notebookModel, cell, output) {
39
+ return React.createElement(notebook_cell_toolbar_1.NotebookCellSidebar, { getMenuItems: () => this.getMenuItems(menuPath, notebookModel, cell, output), onContextKeysChanged: cell.notebookCellContextManager.onDidChangeContext });
40
+ }
41
+ getMenuItems(menuItemPath, notebookModel, cell, output) {
42
+ var _a, _b, _c;
43
+ const inlineItems = [];
44
+ for (const menuNode of this.menuRegistry.getMenu(menuItemPath).children) {
45
+ if (!menuNode.when || this.contextKeyService.match(menuNode.when, (_a = cell.context) !== null && _a !== void 0 ? _a : undefined)) {
46
+ if (menuNode.role === 2 /* Flat */) {
47
+ inlineItems.push(...(_c = (_b = menuNode.children) === null || _b === void 0 ? void 0 : _b.map(child => this.createToolbarItem(child, notebookModel, cell, output))) !== null && _c !== void 0 ? _c : []);
48
+ }
49
+ else {
50
+ inlineItems.push(this.createToolbarItem(menuNode, notebookModel, cell, output));
51
+ }
52
+ }
53
+ }
54
+ return inlineItems;
55
+ }
56
+ createToolbarItem(menuNode, notebookModel, cell, output) {
57
+ const menuPath = menuNode.role === 0 /* Submenu */ ? this.menuRegistry.getPath(menuNode) : undefined;
58
+ return {
59
+ id: menuNode.id,
60
+ icon: menuNode.icon,
61
+ label: menuNode.label,
62
+ onClick: menuPath ?
63
+ e => this.contextMenuRenderer.render({
64
+ anchor: e.nativeEvent,
65
+ menuPath,
66
+ includeAnchorArg: false,
67
+ args: [notebookModel, cell, output]
68
+ }) :
69
+ () => this.commandRegistry.executeCommand(menuNode.command, notebookModel, cell, output)
70
+ };
71
+ }
72
+ };
73
+ __decorate([
74
+ (0, inversify_1.inject)(core_1.MenuModelRegistry),
75
+ __metadata("design:type", core_1.MenuModelRegistry)
76
+ ], NotebookCellToolbarFactory.prototype, "menuRegistry", void 0);
77
+ __decorate([
78
+ (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
79
+ __metadata("design:type", Object)
80
+ ], NotebookCellToolbarFactory.prototype, "contextKeyService", void 0);
81
+ __decorate([
82
+ (0, inversify_1.inject)(browser_1.ContextMenuRenderer),
83
+ __metadata("design:type", browser_1.ContextMenuRenderer)
84
+ ], NotebookCellToolbarFactory.prototype, "contextMenuRenderer", void 0);
85
+ __decorate([
86
+ (0, inversify_1.inject)(core_1.CommandRegistry),
87
+ __metadata("design:type", core_1.CommandRegistry)
88
+ ], NotebookCellToolbarFactory.prototype, "commandRegistry", void 0);
89
+ NotebookCellToolbarFactory = __decorate([
90
+ (0, inversify_1.injectable)()
91
+ ], NotebookCellToolbarFactory);
92
+ exports.NotebookCellToolbarFactory = NotebookCellToolbarFactory;
93
+ //# sourceMappingURL=notebook-cell-toolbar-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-cell-toolbar-factory.js","sourceRoot":"","sources":["../../../src/browser/view/notebook-cell-toolbar-factory.tsx"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;;;;;;;;AAEhF,kDAAkD;AAClD,sCAAiG;AACjG,4DAAkE;AAClE,qFAAgF;AAChF,mEAAmF;AACnF,qDAA8D;AAa9D,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;IAcnC,iBAAiB,CAAC,QAAkB,EAAE,aAA4B,EAAE,IAAuB;QACvF,OAAO,oBAAC,2CAAmB,IAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,CAAC,EAC5F,oBAAoB,EAAE,IAAI,CAAC,0BAA0B,CAAC,kBAAkB,GAAI,CAAC;IACrF,CAAC;IAED,aAAa,CAAC,QAAkB,EAAE,aAA4B,EAAE,IAAuB,EAAE,MAAgC;QACrH,OAAO,oBAAC,2CAAmB,IAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC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,EAAE,QAAQ,CAAC,IAAI;YACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,OAAO,EAAE,QAAQ,CAAC,CAAC;gBACf,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAChC;oBACI,MAAM,EAAE,CAAC,CAAC,WAAW;oBACrB,QAAQ;oBACR,gBAAgB,EAAE,KAAK;oBACvB,IAAI,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC;iBACtC,CAAC,CAAC,CAAC;gBACR,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC;SAChG,CAAC;IACN,CAAC;CACJ,CAAA;AArDG;IADC,IAAA,kBAAM,EAAC,wBAAiB,CAAC;8BACF,wBAAiB;gEAAC;AAG1C;IADC,IAAA,kBAAM,EAAC,uCAAiB,CAAC;;qEACqB;AAG/C;IADC,IAAA,kBAAM,EAAC,6BAAmB,CAAC;8BACY,6BAAmB;uEAAC;AAG5D;IADC,IAAA,kBAAM,EAAC,sBAAe,CAAC;8BACY,sBAAe;mEAAC;AAZ3C,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CAwDtC;AAxDY,gEAA0B"}
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ import { NotebookCellToolbarItem } from './notebook-cell-toolbar-factory';
4
+ import { DisposableCollection, Event } from '@theia/core';
5
+ export interface NotebookCellToolbarProps {
6
+ getMenuItems: () => NotebookCellToolbarItem[];
7
+ onContextKeysChanged: Event<void>;
8
+ }
9
+ interface NotebookCellToolbarState {
10
+ inlineItems: NotebookCellToolbarItem[];
11
+ }
12
+ declare abstract class NotebookCellActionItems extends React.Component<NotebookCellToolbarProps, NotebookCellToolbarState> {
13
+ protected toDispose: DisposableCollection;
14
+ constructor(props: NotebookCellToolbarProps);
15
+ componentWillUnmount(): void;
16
+ protected renderItem(item: NotebookCellToolbarItem): React.ReactNode;
17
+ }
18
+ export declare class NotebookCellToolbar extends NotebookCellActionItems {
19
+ render(): React.ReactNode;
20
+ }
21
+ export declare class NotebookCellSidebar extends NotebookCellActionItems {
22
+ render(): React.ReactNode;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=notebook-cell-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-cell-toolbar.d.ts","sourceRoot":"","sources":["../../../src/browser/view/notebook-cell-toolbar.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,wBAAwB;IACrC,YAAY,EAAE,MAAM,uBAAuB,EAAE,CAAC;IAC9C,oBAAoB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,uBAAuB,EAAE,CAAC;CAC1C;AAED,uBAAe,uBAAwB,SAAQ,KAAK,CAAC,SAAS,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAE9G,SAAS,CAAC,SAAS,uBAA8B;gBAErC,KAAK,EAAE,wBAAwB;IAQlC,oBAAoB,IAAI,IAAI;IAIrC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,uBAAuB,GAAG,KAAK,CAAC,SAAS;CAIvE;AAED,qBAAa,mBAAoB,SAAQ,uBAAuB;IAEnD,MAAM,IAAI,KAAK,CAAC,SAAS;CAMrC;AAED,qBAAa,mBAAoB,SAAQ,uBAAuB;IAEnD,MAAM,IAAI,KAAK,CAAC,SAAS;CAKrC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotebookCellSidebar = exports.NotebookCellToolbar = void 0;
4
+ // *****************************************************************************
5
+ // Copyright (C) 2023 TypeFox and others.
6
+ //
7
+ // This program and the accompanying materials are made available under the
8
+ // terms of the Eclipse Public License v. 2.0 which is available at
9
+ // http://www.eclipse.org/legal/epl-2.0.
10
+ //
11
+ // This Source Code may also be made available under the following Secondary
12
+ // Licenses when the conditions for such availability set forth in the Eclipse
13
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
+ // with the GNU Classpath Exception which is available at
15
+ // https://www.gnu.org/software/classpath/license.html.
16
+ //
17
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
18
+ // *****************************************************************************
19
+ const React = require("@theia/core/shared/react");
20
+ const browser_1 = require("@theia/core/lib/browser");
21
+ const core_1 = require("@theia/core");
22
+ class NotebookCellActionItems extends React.Component {
23
+ constructor(props) {
24
+ super(props);
25
+ this.toDispose = new core_1.DisposableCollection();
26
+ this.toDispose.push(props.onContextKeysChanged(e => {
27
+ this.setState({ inlineItems: this.props.getMenuItems() });
28
+ }));
29
+ this.state = { inlineItems: this.props.getMenuItems() };
30
+ }
31
+ componentWillUnmount() {
32
+ this.toDispose.dispose();
33
+ }
34
+ renderItem(item) {
35
+ return React.createElement("div", { key: item.id, title: item.label, onClick: item.onClick, className: `${item.icon} ${browser_1.ACTION_ITEM} theia-notebook-cell-toolbar-item` });
36
+ }
37
+ }
38
+ class NotebookCellToolbar extends NotebookCellActionItems {
39
+ render() {
40
+ return React.createElement("div", { className: 'theia-notebook-cell-toolbar' }, this.state.inlineItems.map(item => this.renderItem(item)));
41
+ }
42
+ }
43
+ exports.NotebookCellToolbar = NotebookCellToolbar;
44
+ class NotebookCellSidebar extends NotebookCellActionItems {
45
+ render() {
46
+ return React.createElement("div", { className: 'theia-notebook-cell-sidebar' }, this.state.inlineItems.map(item => this.renderItem(item)));
47
+ }
48
+ }
49
+ exports.NotebookCellSidebar = NotebookCellSidebar;
50
+ //# sourceMappingURL=notebook-cell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QACX,OAAO,6BAAK,SAAS,EAAC,6BAA6B,IAC9C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CACxD,CAAC;IACX,CAAC;CAEJ;AARD,kDAQC;AAED,MAAa,mBAAoB,SAAQ,uBAAuB;IAEnD,MAAM;QACX,OAAO,6BAAK,SAAS,EAAC,6BAA6B,IAC9C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CACxD,CAAC;IACX,CAAC;CACJ;AAPD,kDAOC"}
@@ -0,0 +1,47 @@
1
+ /// <reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ import { MonacoEditorServices } from '@theia/monaco/lib/browser/monaco-editor';
4
+ import { CellOutputWebviewFactory, CellOutputWebview } from '../renderers/cell-output-webview';
5
+ import { NotebookRendererRegistry } from '../notebook-renderer-registry';
6
+ import { NotebookCellModel } from '../view-model/notebook-cell-model';
7
+ import { NotebookModel } from '../view-model/notebook-model';
8
+ import { CellRenderer } from './notebook-cell-list-view';
9
+ import { NotebookCellToolbarFactory } from './notebook-cell-toolbar-factory';
10
+ import { CellExecution, NotebookExecutionStateService } from '../service/notebook-execution-state-service';
11
+ import { DisposableCollection } from '@theia/core';
12
+ export declare class NotebookCodeCellRenderer implements CellRenderer {
13
+ protected readonly monacoServices: MonacoEditorServices;
14
+ protected readonly notebookRendererRegistry: NotebookRendererRegistry;
15
+ protected readonly cellOutputWebviewFactory: CellOutputWebviewFactory;
16
+ protected readonly notebookCellToolbarFactory: NotebookCellToolbarFactory;
17
+ protected readonly executionStateService: NotebookExecutionStateService;
18
+ render(notebookModel: NotebookModel, cell: NotebookCellModel, handle: number): React.ReactNode;
19
+ }
20
+ export interface NotebookCodeCellStatusProps {
21
+ cell: NotebookCellModel;
22
+ executionStateService: NotebookExecutionStateService;
23
+ }
24
+ export declare class NotebookCodeCellStatus extends React.Component<NotebookCodeCellStatusProps, {
25
+ currentExecution?: CellExecution;
26
+ }> {
27
+ protected toDispose: DisposableCollection;
28
+ constructor(props: NotebookCodeCellStatusProps);
29
+ componentWillUnmount(): void;
30
+ render(): React.ReactNode;
31
+ private renderExecutionState;
32
+ private getExecutionTime;
33
+ }
34
+ interface NotebookCellOutputProps {
35
+ cell: NotebookCellModel;
36
+ outputWebviewFactory: CellOutputWebviewFactory;
37
+ renderSidebar: () => React.ReactNode;
38
+ }
39
+ export declare class NotebookCodeCellOutputs extends React.Component<NotebookCellOutputProps> {
40
+ protected outputsWebview: CellOutputWebview | undefined;
41
+ constructor(props: NotebookCellOutputProps);
42
+ componentDidMount(): Promise<void>;
43
+ componentDidUpdate(): void;
44
+ render(): React.ReactNode;
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=notebook-code-cell-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-code-cell-view.d.ts","sourceRoot":"","sources":["../../../src/browser/view/notebook-code-cell-view.tsx"],"names":[],"mappings":";AAiBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAG3G,OAAO,EAAE,oBAAoB,EAAE,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BAAkB,IAAI,IAAI;IAM1B,MAAM,IAAI,KAAK,CAAC,SAAS;CAUrC"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2023 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.NotebookCodeCellOutputs = exports.NotebookCodeCellStatus = exports.NotebookCodeCellRenderer = void 0;
28
+ const inversify_1 = require("@theia/core/shared/inversify");
29
+ const React = require("@theia/core/shared/react");
30
+ const monaco_editor_1 = require("@theia/monaco/lib/browser/monaco-editor");
31
+ const cell_output_webview_1 = require("../renderers/cell-output-webview");
32
+ const notebook_renderer_registry_1 = require("../notebook-renderer-registry");
33
+ const notebook_cell_editor_1 = require("./notebook-cell-editor");
34
+ const notebook_cell_toolbar_factory_1 = require("./notebook-cell-toolbar-factory");
35
+ const notebook_cell_actions_contribution_1 = require("../contributions/notebook-cell-actions-contribution");
36
+ const notebook_execution_state_service_1 = require("../service/notebook-execution-state-service");
37
+ const browser_1 = require("@theia/core/lib/browser");
38
+ const common_1 = require("../../common");
39
+ const core_1 = require("@theia/core");
40
+ let NotebookCodeCellRenderer = class NotebookCodeCellRenderer {
41
+ render(notebookModel, cell, handle) {
42
+ return React.createElement("div", null,
43
+ React.createElement("div", { className: 'theia-notebook-cell-with-sidebar' },
44
+ React.createElement("div", null, this.notebookCellToolbarFactory.renderSidebar(notebook_cell_actions_contribution_1.NotebookCellActionContribution.CODE_CELL_SIDEBAR_MENU, notebookModel, cell)),
45
+ React.createElement("div", { className: 'theia-notebook-cell-editor-container' },
46
+ React.createElement(notebook_cell_editor_1.CellEditor, { notebookModel: notebookModel, cell: cell, monacoServices: this.monacoServices }),
47
+ React.createElement(NotebookCodeCellStatus, { cell: cell, executionStateService: this.executionStateService }))),
48
+ React.createElement("div", { className: 'theia-notebook-cell-with-sidebar' },
49
+ React.createElement(NotebookCodeCellOutputs, { cell: cell, outputWebviewFactory: this.cellOutputWebviewFactory, renderSidebar: () => this.notebookCellToolbarFactory.renderSidebar(notebook_cell_actions_contribution_1.NotebookCellActionContribution.OUTPUT_SIDEBAR_MENU, notebookModel, cell, cell.outputs[0]) })));
50
+ }
51
+ };
52
+ __decorate([
53
+ (0, inversify_1.inject)(monaco_editor_1.MonacoEditorServices),
54
+ __metadata("design:type", monaco_editor_1.MonacoEditorServices)
55
+ ], NotebookCodeCellRenderer.prototype, "monacoServices", void 0);
56
+ __decorate([
57
+ (0, inversify_1.inject)(notebook_renderer_registry_1.NotebookRendererRegistry),
58
+ __metadata("design:type", notebook_renderer_registry_1.NotebookRendererRegistry)
59
+ ], NotebookCodeCellRenderer.prototype, "notebookRendererRegistry", void 0);
60
+ __decorate([
61
+ (0, inversify_1.inject)(cell_output_webview_1.CellOutputWebviewFactory),
62
+ __metadata("design:type", Function)
63
+ ], NotebookCodeCellRenderer.prototype, "cellOutputWebviewFactory", void 0);
64
+ __decorate([
65
+ (0, inversify_1.inject)(notebook_cell_toolbar_factory_1.NotebookCellToolbarFactory),
66
+ __metadata("design:type", notebook_cell_toolbar_factory_1.NotebookCellToolbarFactory)
67
+ ], NotebookCodeCellRenderer.prototype, "notebookCellToolbarFactory", void 0);
68
+ __decorate([
69
+ (0, inversify_1.inject)(notebook_execution_state_service_1.NotebookExecutionStateService),
70
+ __metadata("design:type", notebook_execution_state_service_1.NotebookExecutionStateService)
71
+ ], NotebookCodeCellRenderer.prototype, "executionStateService", void 0);
72
+ NotebookCodeCellRenderer = __decorate([
73
+ (0, inversify_1.injectable)()
74
+ ], NotebookCodeCellRenderer);
75
+ exports.NotebookCodeCellRenderer = NotebookCodeCellRenderer;
76
+ class NotebookCodeCellStatus extends React.Component {
77
+ constructor(props) {
78
+ super(props);
79
+ this.toDispose = new core_1.DisposableCollection();
80
+ this.state = {};
81
+ this.toDispose.push(props.executionStateService.onDidChangeExecution(event => {
82
+ if (event.affectsCell(this.props.cell.uri)) {
83
+ this.setState({ currentExecution: event.changed });
84
+ }
85
+ }));
86
+ }
87
+ componentWillUnmount() {
88
+ this.toDispose.dispose();
89
+ }
90
+ render() {
91
+ return React.createElement("div", { className: 'notebook-cell-status' },
92
+ React.createElement("div", { className: 'notebook-cell-status-left' }, this.renderExecutionState()),
93
+ React.createElement("div", { className: 'notebook-cell-status-right' },
94
+ React.createElement("span", null, this.props.cell.language)));
95
+ }
96
+ renderExecutionState() {
97
+ var _a;
98
+ const state = (_a = this.state.currentExecution) === null || _a === void 0 ? void 0 : _a.state;
99
+ const { lastRunSuccess } = this.props.cell.internalMetadata;
100
+ let iconClasses = undefined;
101
+ let color = undefined;
102
+ if (!state && lastRunSuccess) {
103
+ iconClasses = (0, browser_1.codicon)('check');
104
+ color = 'green';
105
+ }
106
+ else if (!state && lastRunSuccess === false) {
107
+ iconClasses = (0, browser_1.codicon)('error');
108
+ color = 'red';
109
+ }
110
+ else if (state === common_1.NotebookCellExecutionState.Pending || state === common_1.NotebookCellExecutionState.Unconfirmed) {
111
+ iconClasses = (0, browser_1.codicon)('clock');
112
+ }
113
+ else if (state === common_1.NotebookCellExecutionState.Executing) {
114
+ iconClasses = `${(0, browser_1.codicon)('sync')} theia-animation-spin`;
115
+ }
116
+ return React.createElement(React.Fragment, null, iconClasses &&
117
+ React.createElement(React.Fragment, null,
118
+ React.createElement("span", { className: `${iconClasses} notebook-cell-status-item`, style: { color } }),
119
+ React.createElement("div", { className: 'notebook-cell-status-item' }, this.getExecutionTime())));
120
+ }
121
+ getExecutionTime() {
122
+ const { runStartTime, runEndTime } = this.props.cell.internalMetadata;
123
+ if (runStartTime && runEndTime) {
124
+ return `${((runEndTime - runStartTime) / 1000).toLocaleString(undefined, { maximumFractionDigits: 1, minimumFractionDigits: 1 })}s`;
125
+ }
126
+ return '0.0s';
127
+ }
128
+ }
129
+ exports.NotebookCodeCellStatus = NotebookCodeCellStatus;
130
+ class NotebookCodeCellOutputs extends React.Component {
131
+ constructor(props) {
132
+ super(props);
133
+ }
134
+ async componentDidMount() {
135
+ const { cell, outputWebviewFactory } = this.props;
136
+ cell.onDidChangeOutputs(async () => {
137
+ if (!this.outputsWebview && cell.outputs.length > 0) {
138
+ this.outputsWebview = await outputWebviewFactory(cell);
139
+ }
140
+ else if (this.outputsWebview && cell.outputs.length === 0) {
141
+ this.outputsWebview.dispose();
142
+ this.outputsWebview = undefined;
143
+ }
144
+ this.forceUpdate();
145
+ });
146
+ if (cell.outputs.length > 0) {
147
+ this.outputsWebview = await outputWebviewFactory(cell);
148
+ this.forceUpdate();
149
+ }
150
+ }
151
+ componentDidUpdate() {
152
+ var _a, _b;
153
+ if (!((_a = this.outputsWebview) === null || _a === void 0 ? void 0 : _a.isAttached())) {
154
+ (_b = this.outputsWebview) === null || _b === void 0 ? void 0 : _b.attachWebview();
155
+ }
156
+ }
157
+ render() {
158
+ return this.outputsWebview ?
159
+ React.createElement(React.Fragment, null,
160
+ this.props.renderSidebar(),
161
+ this.outputsWebview.render()) :
162
+ React.createElement(React.Fragment, null);
163
+ }
164
+ }
165
+ exports.NotebookCodeCellOutputs = NotebookCodeCellOutputs;
166
+ //# sourceMappingURL=notebook-code-cell-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-code-cell-view.js","sourceRoot":"","sources":["../../../src/browser/view/notebook-code-cell-view.tsx"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;;;;;;;;AAEhF,4DAAkE;AAClE,kDAAkD;AAClD,2EAA+E;AAC/E,0EAA+F;AAC/F,8EAAyE;AAGzE,iEAAoD;AAEpD,mFAA6E;AAC7E,4GAAqG;AACrG,kGAA2G;AAC3G,qDAAkD;AAClD,yCAA0D;AAC1D,sCAAmD;AAGnD,IAAa,wBAAwB,GAArC,MAAa,wBAAwB;IAgBjC,MAAM,CAAC,aAA4B,EAAE,IAAuB,EAAE,MAAc;QACxE,OAAO;YACH,6BAAK,SAAS,EAAC,kCAAkC;gBAC7C,iCACK,IAAI,CAAC,0BAA0B,CAAC,aAAa,CAAC,mEAA8B,CAAC,sBAAsB,EAAE,aAAa,EAAE,IAAI,CAAC,CAGxH;gBACN,6BAAK,SAAS,EAAC,sCAAsC;oBACjD,oBAAC,iCAAU,IAAC,aAAa,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,GAAI;oBAC7F,oBAAC,sBAAsB,IAAC,IAAI,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,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AAC;QACvB,CAAC,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,IAAI,CAAC,cAAc,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAC;YACvD,IAAI,CAAC,WAAW,EAAE,CAAC;SACtB;IACL,CAAC;IAEQ,kBAAkB;;QACvB,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,UAAU,EAAE,CAAA,EAAE;YACpC,MAAA,IAAI,CAAC,cAAc,0CAAE,aAAa,EAAE,CAAC;SACxC;IACL,CAAC;IAEQ,MAAM;QACX,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;YACxB;gBACK,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;gBAC1B,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAC9B,CAAC,CAAC;YACL,yCAAK,CAAC;IAEd,CAAC;CAEJ;AAzCD,0DAyCC"}
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import { CommandRegistry, DisposableCollection, MenuModelRegistry, MenuNode } from '@theia/core';
3
+ import * as React from '@theia/core/shared/react';
4
+ import { NotebookModel } from '../view-model/notebook-model';
5
+ import { NotebookKernelService } from '../service/notebook-kernel-service';
6
+ import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
7
+ export interface NotebookMainToolbarProps {
8
+ notebookModel: NotebookModel;
9
+ menuRegistry: MenuModelRegistry;
10
+ notebookKernelService: NotebookKernelService;
11
+ commandRegistry: CommandRegistry;
12
+ contextKeyService: ContextKeyService;
13
+ }
14
+ export declare class NotebookMainToolbarRenderer {
15
+ protected readonly notebookKernelService: NotebookKernelService;
16
+ protected readonly commandRegistry: CommandRegistry;
17
+ protected readonly menuRegistry: MenuModelRegistry;
18
+ protected readonly contextKeyService: ContextKeyService;
19
+ render(notebookModel: NotebookModel): React.ReactNode;
20
+ }
21
+ export declare class NotebookMainToolbar extends React.Component<NotebookMainToolbarProps, {
22
+ selectedKernelLabel?: string;
23
+ }> {
24
+ protected toDispose: DisposableCollection;
25
+ constructor(props: NotebookMainToolbarProps);
26
+ componentWillUnmount(): void;
27
+ render(): React.ReactNode;
28
+ protected renderMenuItem(item: MenuNode): React.ReactNode;
29
+ private getMenuItems;
30
+ }
31
+ //# sourceMappingURL=notebook-main-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-main-toolbar.d.ts","sourceRoot":"","sources":["../../../src/browser/view/notebook-main-toolbar.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAwB,oBAAoB,EAAE,iBAAiB,EAAE,QAAQ,EAAO,MAAM,aAAa,CAAC;AAC5H,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAEhF,MAAM,WAAW,wBAAwB;IACrC,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,iBAAiB,CAAC;IAChC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;CACxC;AAED,qBACa,2BAA2B;IACL,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IACtE,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAClD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACnD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAEnF,MAAM,CAAC,aAAa,EAAE,aAAa,GAAG,KAAK,CAAC,SAAS;CAQxD;AAED,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,SAAS,CAAC,wBAAwB,EAAE;IAAE,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;IAEhH,SAAS,CAAC,SAAS,uBAA8B;gBAErC,KAAK,EAAE,wBAAwB;IAiBlC,oBAAoB,IAAI,IAAI;IAI5B,MAAM,IAAI,KAAK,CAAC,SAAS;IAclC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC,SAAS;IAqBzD,OAAO,CAAC,YAAY;CAKvB"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.NotebookMainToolbar = exports.NotebookMainToolbarRenderer = void 0;
13
+ // *****************************************************************************
14
+ // Copyright (C) 2023 TypeFox and others.
15
+ //
16
+ // This program and the accompanying materials are made available under the
17
+ // terms of the Eclipse Public License v. 2.0 which is available at
18
+ // http://www.eclipse.org/legal/epl-2.0.
19
+ //
20
+ // This Source Code may also be made available under the following Secondary
21
+ // Licenses when the conditions for such availability set forth in the Eclipse
22
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
23
+ // with the GNU Classpath Exception which is available at
24
+ // https://www.gnu.org/software/classpath/license.html.
25
+ //
26
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
27
+ // *****************************************************************************
28
+ const core_1 = require("@theia/core");
29
+ const React = require("@theia/core/shared/react");
30
+ const browser_1 = require("@theia/core/lib/browser");
31
+ const notebook_actions_contribution_1 = require("../contributions/notebook-actions-contribution");
32
+ const notebook_kernel_service_1 = require("../service/notebook-kernel-service");
33
+ const inversify_1 = require("@theia/core/shared/inversify");
34
+ const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
35
+ let NotebookMainToolbarRenderer = class NotebookMainToolbarRenderer {
36
+ render(notebookModel) {
37
+ return React.createElement(NotebookMainToolbar, { notebookModel: notebookModel, menuRegistry: this.menuRegistry, notebookKernelService: this.notebookKernelService, commandRegistry: this.commandRegistry, contextKeyService: this.contextKeyService });
38
+ }
39
+ };
40
+ __decorate([
41
+ (0, inversify_1.inject)(notebook_kernel_service_1.NotebookKernelService),
42
+ __metadata("design:type", notebook_kernel_service_1.NotebookKernelService)
43
+ ], NotebookMainToolbarRenderer.prototype, "notebookKernelService", void 0);
44
+ __decorate([
45
+ (0, inversify_1.inject)(core_1.CommandRegistry),
46
+ __metadata("design:type", core_1.CommandRegistry)
47
+ ], NotebookMainToolbarRenderer.prototype, "commandRegistry", void 0);
48
+ __decorate([
49
+ (0, inversify_1.inject)(core_1.MenuModelRegistry),
50
+ __metadata("design:type", core_1.MenuModelRegistry)
51
+ ], NotebookMainToolbarRenderer.prototype, "menuRegistry", void 0);
52
+ __decorate([
53
+ (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
54
+ __metadata("design:type", Object)
55
+ ], NotebookMainToolbarRenderer.prototype, "contextKeyService", void 0);
56
+ NotebookMainToolbarRenderer = __decorate([
57
+ (0, inversify_1.injectable)()
58
+ ], NotebookMainToolbarRenderer);
59
+ exports.NotebookMainToolbarRenderer = NotebookMainToolbarRenderer;
60
+ class NotebookMainToolbar extends React.Component {
61
+ constructor(props) {
62
+ var _a;
63
+ super(props);
64
+ this.toDispose = new core_1.DisposableCollection();
65
+ this.state = { selectedKernelLabel: (_a = props.notebookKernelService.getSelectedOrSuggestedKernel(props.notebookModel)) === null || _a === void 0 ? void 0 : _a.label };
66
+ this.toDispose.push(props.notebookKernelService.onDidChangeSelectedKernel(event => {
67
+ var _a, _b;
68
+ if (props.notebookModel.uri.isEqual(event.notebook)) {
69
+ this.setState({ selectedKernelLabel: (_b = props.notebookKernelService.getKernel((_a = event.newKernel) !== null && _a !== void 0 ? _a : '')) === null || _b === void 0 ? void 0 : _b.label });
70
+ }
71
+ }));
72
+ // in case the selected kernel is added after the notebook is loaded
73
+ this.toDispose.push(props.notebookKernelService.onDidAddKernel(() => {
74
+ var _a;
75
+ if (!this.state.selectedKernelLabel) {
76
+ this.setState({ selectedKernelLabel: (_a = props.notebookKernelService.getSelectedOrSuggestedKernel(props.notebookModel)) === null || _a === void 0 ? void 0 : _a.label });
77
+ }
78
+ }));
79
+ }
80
+ componentWillUnmount() {
81
+ this.toDispose.dispose();
82
+ }
83
+ render() {
84
+ var _a;
85
+ return React.createElement("div", { className: 'theia-notebook-main-toolbar' },
86
+ this.getMenuItems().map(item => this.renderMenuItem(item)),
87
+ React.createElement("div", { style: { flexGrow: 1 } }),
88
+ React.createElement("div", { className: 'theia-notebook-main-toolbar-item', onClick: () => this.props.commandRegistry.executeCommand(notebook_actions_contribution_1.NotebookCommands.SELECT_KERNEL_COMMAND.id, this.props.notebookModel) },
89
+ React.createElement("span", { className: (0, browser_1.codicon)('server-environment') }),
90
+ React.createElement("span", { className: ' theia-notebook-main-toolbar-item-text' }, (_a = this.state.selectedKernelLabel) !== null && _a !== void 0 ? _a : core_1.nls.localizeByDefault('Select Kernel'))));
91
+ }
92
+ renderMenuItem(item) {
93
+ var _a;
94
+ if (item.role === 1 /* Group */) {
95
+ const itemNodes = (_a = item.children) === null || _a === void 0 ? void 0 : _a.map(child => this.renderMenuItem(child)).filter(child => !!child);
96
+ return React.createElement(React.Fragment, { key: item.id },
97
+ itemNodes,
98
+ itemNodes && itemNodes.length > 0 && React.createElement("span", { key: `${item.id}-separator`, className: 'theia-notebook-toolbar-separator' }));
99
+ }
100
+ else if (!item.when || this.props.contextKeyService.match(item.when)) {
101
+ return React.createElement("div", { key: item.id, title: item.id, className: 'theia-notebook-main-toolbar-item', onClick: () => {
102
+ if (item.command) {
103
+ this.props.commandRegistry.executeCommand(item.command, this.props.notebookModel);
104
+ }
105
+ } },
106
+ React.createElement("span", { className: item.icon }),
107
+ React.createElement("span", { className: 'theia-notebook-main-toolbar-item-text' }, item.label));
108
+ }
109
+ return undefined;
110
+ }
111
+ getMenuItems() {
112
+ const menuPath = notebook_actions_contribution_1.NotebookMenus.NOTEBOOK_MAIN_TOOLBAR;
113
+ const pluginCommands = this.props.menuRegistry.getMenuNode(menuPath).children;
114
+ return this.props.menuRegistry.getMenu([menuPath]).children.concat(pluginCommands);
115
+ }
116
+ }
117
+ exports.NotebookMainToolbar = NotebookMainToolbar;
118
+ //# sourceMappingURL=notebook-main-toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-main-toolbar.js","sourceRoot":"","sources":["../../../src/browser/view/notebook-main-toolbar.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,sCAA4H;AAC5H,kDAAkD;AAClD,qDAAkD;AAClD,kGAAiG;AAEjG,gFAA2E;AAC3E,4DAAkE;AAClE,qFAAgF;AAWhF,IAAa,2BAA2B,GAAxC,MAAa,2BAA2B;IAMpC,MAAM,CAAC,aAA4B;QAC/B,OAAO,oBAAC,mBAAmB,IAAC,aAAa,EAAE,aAAa,EACpD,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EACjD,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,iBAAiB,EAAE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<reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ import { NotebookModel } from '../view-model/notebook-model';
4
+ import { CellRenderer } from './notebook-cell-list-view';
5
+ import { NotebookCellModel } from '../view-model/notebook-cell-model';
6
+ import { MonacoEditorServices } from '@theia/monaco/lib/browser/monaco-editor';
7
+ export declare class NotebookMarkdownCellRenderer implements CellRenderer {
8
+ private readonly markdownRenderer;
9
+ protected readonly monacoServices: MonacoEditorServices;
10
+ render(notebookModel: NotebookModel, cell: NotebookCellModel): React.ReactNode;
11
+ }
12
+ //# sourceMappingURL=notebook-markdown-cell-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-markdown-cell-view.d.ts","sourceRoot":"","sources":["../../../src/browser/view/notebook-markdown-cell-view.tsx"],"names":[],"mappings":";AAgBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAG/E,qBACa,4BAA6B,YAAW,YAAY;IAG7D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IAEpD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAExD,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,IAAI,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS;CAKjF"}